CMake: rename reserved target name "help" (CMake 2.8.12 and later).

The executable built is still help(.exe).


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10370 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Albrecht Schlosser 2014-10-09 16:11:36 +00:00
parent cb6cc2d5a9
commit 982e6ffb2c
1 changed files with 21 additions and 9 deletions

View File

@ -4,7 +4,7 @@
# macros.cmake defines macros used by the build system
# Written by Michael Surette
#
# Copyright 1998-2010 by Bill Spitzak and others.
# Copyright 1998-2014 by Bill Spitzak and others.
#
# This library is free software. Distribution and use rights are outlined in
# the file "COPYING" which should have been included with this file. If this
@ -78,8 +78,17 @@ endmacro(FL_ADD_LIBRARY LIBNAME LIBTYPE LIBFILES)
#######################################################################
macro(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
set(srcs)
set(flsrcs)
set(srcs) # source files
set(flsrcs) # fluid source files
set(tname ${NAME}) # target name
set(oname ${NAME}) # output (executable) name
# rename reserved target name "help" (CMake 2.8.12 and later)
if(${tname} MATCHES "^help$")
set(tname "test_help")
endif(${tname} MATCHES "^help$")
foreach(src ${SOURCES})
if("${src}" MATCHES ".fl$")
list(APPEND flsrcs ${src})
@ -90,24 +99,27 @@ macro(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
if(flsrcs)
set(FLTK_WRAP_UI TRUE)
fltk_wrap_ui(${NAME} ${flsrcs})
fltk_wrap_ui(${tname} ${flsrcs})
endif(flsrcs)
add_executable(${NAME} WIN32 ${srcs} ${${NAME}_FLTK_UI_SRCS})
add_executable(${tname} WIN32 ${srcs} ${${tname}_FLTK_UI_SRCS})
set_target_properties(${tname}
PROPERTIES OUTPUT_NAME ${oname}
)
target_link_libraries(${NAME} ${LIBRARIES})
target_link_libraries(${tname} ${LIBRARIES})
# link in optional libraries
if(USE_XFT)
target_link_libraries(${NAME} ${X11_Xft_LIB})
target_link_libraries(${tname} ${X11_Xft_LIB})
endif(USE_XFT)
if(HAVE_XINERAMA)
target_link_libraries(${NAME} ${X11_Xinerama_LIB})
target_link_libraries(${tname} ${X11_Xinerama_LIB})
endif(HAVE_XINERAMA)
# install the example
install(TARGETS ${NAME}
install(TARGETS ${tname}
DESTINATION ${FLTK_EXAMPLES_PATH}
)