[CMake] Work around CMake bug in CMake versions 3.4.x.
CMake versions 3.4.x crash when using fltk_wrap_ui, a built-in CMake command. According to the CMake devs this will be fixed in CMake 3.5. However, since fltk_wrap_ui is no longer necessary (it can replaced by custom build commands) and some Linux distributions deploy CMake 3.4.x we decided to use an own replacement function. This makes sure that FLTK can be built with CMake 3.4.x, but FLTK users may still have to rewrite their own CMake files to not use fltk_wrap_ui. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@11081 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
parent
01e5f26f2f
commit
1139af35af
@ -75,6 +75,23 @@ macro(FL_ADD_LIBRARY LIBNAME LIBTYPE LIBFILES)
|
||||
|
||||
endmacro(FL_ADD_LIBRARY LIBNAME LIBTYPE LIBFILES)
|
||||
|
||||
#######################################################################
|
||||
# USAGE: FLTK_RUN_FLUID TARGET_NAME "FLUID_SOURCE [.. FLUID_SOURCE]"
|
||||
function(FLTK_RUN_FLUID TARGET SOURCES)
|
||||
set(CXX_FILES)
|
||||
foreach(src ${SOURCES})
|
||||
if("${src}" MATCHES "\\.fl$")
|
||||
string(REGEX REPLACE "(.*).fl" \\1 basename ${src})
|
||||
add_custom_command(
|
||||
OUTPUT "${basename}.cxx" "${basename}.h"
|
||||
COMMAND fluid -c ${CMAKE_CURRENT_SOURCE_DIR}/${src}
|
||||
)
|
||||
list(APPEND CXX_FILES "${basename}.cxx")
|
||||
endif("${src}" MATCHES "\\.fl$")
|
||||
set(${TARGET} ${CXX_FILES} PARENT_SCOPE)
|
||||
endforeach(src)
|
||||
endfunction(FLTK_RUN_FLUID TARGET SOURCES)
|
||||
|
||||
#######################################################################
|
||||
macro(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
|
||||
|
||||
@ -97,9 +114,9 @@ macro(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
|
||||
endif("${src}" MATCHES "\\.fl$")
|
||||
endforeach(src)
|
||||
|
||||
set(FLUID_SOURCES)
|
||||
if(flsrcs)
|
||||
set(FLTK_WRAP_UI TRUE)
|
||||
fltk_wrap_ui(${tname} ${flsrcs})
|
||||
FLTK_RUN_FLUID(FLUID_SOURCES "${flsrcs}")
|
||||
endif(flsrcs)
|
||||
|
||||
if(APPLE AND NOT OPTION_APPLE_X11)
|
||||
@ -112,20 +129,20 @@ macro(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
|
||||
endif(${tname} STREQUAL "blocks" OR ${tname} STREQUAL "checkers" OR ${tname} STREQUAL "sudoku")
|
||||
|
||||
if(DEFINED RESOURCE_PATH)
|
||||
add_executable(${tname} MACOSX_BUNDLE ${srcs} ${RESOURCE_PATH})
|
||||
add_executable(${tname} MACOSX_BUNDLE ${srcs} ${FLUID_SOURCES} ${RESOURCE_PATH})
|
||||
if(${tname} STREQUAL "demo")
|
||||
target_compile_definitions(demo PUBLIC USING_XCODE)
|
||||
endif(${tname} STREQUAL "demo")
|
||||
else()
|
||||
add_executable(${tname} MACOSX_BUNDLE ${srcs} ${${tname}_FLTK_UI_SRCS})
|
||||
add_executable(${tname} MACOSX_BUNDLE ${srcs} ${FLUID_SOURCES})
|
||||
endif(DEFINED RESOURCE_PATH)
|
||||
else()
|
||||
add_executable(${tname} WIN32 ${srcs} ${${tname}_FLTK_UI_SRCS})
|
||||
add_executable(${tname} WIN32 ${srcs} ${FLUID_SOURCES})
|
||||
endif(APPLE AND NOT OPTION_APPLE_X11)
|
||||
|
||||
set_target_properties(${tname}
|
||||
PROPERTIES OUTPUT_NAME ${oname}
|
||||
)
|
||||
PROPERTIES OUTPUT_NAME ${oname}
|
||||
)
|
||||
if(APPLE AND DEFINED RESOURCE_PATH)
|
||||
if(NOT ${tname} STREQUAL "demo")
|
||||
set_target_properties(${tname} PROPERTIES MACOSX_BUNDLE_ICON_FILE ${ICON_NAME})
|
||||
@ -136,7 +153,6 @@ macro(CREATE_EXAMPLE NAME SOURCES LIBRARIES)
|
||||
set_target_properties("editor" PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${PROJECT_SOURCE_DIR}/ide/Xcode4/plists/editor-Info.plist" )
|
||||
endif(APPLE AND (NOT OPTION_APPLE_X11) AND ${tname} STREQUAL "editor")
|
||||
|
||||
|
||||
target_link_libraries(${tname} ${LIBRARIES})
|
||||
|
||||
# link in optional libraries
|
||||
|
Loading…
Reference in New Issue
Block a user