diff options
Diffstat (limited to 'CMake/macros.cmake')
| -rw-r--r-- | CMake/macros.cmake | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/CMake/macros.cmake b/CMake/macros.cmake index caa295eec..a7d3c7a34 100644 --- a/CMake/macros.cmake +++ b/CMake/macros.cmake @@ -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} ) |
