[CMake] Generating Source Files
Jeremy Cowgar
jeremy at cowgar.com
Wed Apr 8 16:58:12 EDT 2009
Bill Hoffman wrote:
> The file that is produced by the execute_process needs to be the one
> that is included by cmake. The idea was:
>
> if( file.cmake does not exist or it is older than eu core files)
> generate file.cmake
>
> include(file.cmake)
It is included... It's included after the EXECUTE_PROCESS call....
int.cmake is generated from the EXECUTE_PROCESS call.
Jeremy
SET( INT_BUILD_DIR "${CMAKE_BINARY_DIR}/source/interpreter" )
SET( EU_CORE_UPDATE 0 )
FOREACH( file ${EU_CORE_FILES} )
IF( "${CMAKE_SOURCE_DIR}/source/${file}" IS_NEWER_THAN
"${INT_BUILD_DIR}/int.cmake" )
SET( EU_CORE_UPDATE 1 )
ENDIF()
ENDFOREACH()
IF( EU_CORE_UPDATE )
MESSAGE( "Translating interpreter..." )
EXECUTE_PROCESS(
COMMAND ${TRANSLATOR} -cmakefile "${CMAKE_SOURCE_DIR}/source/int.ex"
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/source/interpreter" )
ENDIF()
INCLUDE( "${INT_BUILD_DIR}/int.cmake" )
IF( WIN32 )
FIND_LIBRARY( WINSOCK_LIB ws2_32 PATHS "$ENV{WATCOM}/lib386/nt")
IF( NOT WINSOCK_LIB )
MESSAGE( FATAL_ERROR "Could not located the winsock library (ws2_32)")
ENDIF()
ADD_EXECUTABLE( eui WIN32 ${INT_SOURCES} )
TARGET_LINK_LIBRARIES( eui eu_back eu_back_magic ${WINSOCK_LIB} )
IF( WATCOM )
SET_TARGET_PROPERTIES( eui PROPERTIES LINK_FLAGS ${LINK_FLAGS} )
#SET_TARGET_PROPERTIES( euc PROPERTIES LINK_FLAGS " SYS nt_win " )
#SET_TARGET_PROPERTIES( eub PROPERTIES LINK_FLAGS " SYS nt_win " )
ENDIF( WATCOM )
ENDIF()
More information about the CMake
mailing list