diff --git a/CMakeModules/SetupFGFSEmbeddedResources.cmake b/CMakeModules/SetupFGFSEmbeddedResources.cmake index df0c81530..18af97687 100644 --- a/CMakeModules/SetupFGFSEmbeddedResources.cmake +++ b/CMakeModules/SetupFGFSEmbeddedResources.cmake @@ -25,12 +25,4 @@ function(setup_fgfs_embedded_resources) "Either MSVC_3RDPARTY_ROOT or MSVC_3RDPARTY_DIR is empty or unset") endif() endif() - - add_custom_command( - OUTPUT ${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.cxx - ${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.hxx - COMMAND fgrcc --root=${CMAKE_SOURCE_DIR} --output-cpp-file=${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.cxx --init-func-name=initFlightGearEmbeddedResources --output-header-file=${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.hxx --output-header-identifier=_FG_FLIGHTGEAR_EMBEDDED_RESOURCES ${CMAKE_SOURCE_DIR}/src/EmbeddedResources/FlightGear-resources.xml - DEPENDS - fgrcc ${CMAKE_SOURCE_DIR}/src/EmbeddedResources/FlightGear-resources.xml - ) endfunction() diff --git a/src/EmbeddedResources/CMakeLists.txt b/src/EmbeddedResources/CMakeLists.txt index 662623a0e..d72d9629b 100644 --- a/src/EmbeddedResources/CMakeLists.txt +++ b/src/EmbeddedResources/CMakeLists.txt @@ -1,2 +1,18 @@ add_executable(fgrcc fgrcc.cxx fgrcc.hxx) target_link_libraries(fgrcc SimGearCore ${PLATFORM_LIBS}) + +add_custom_target( + embeddedresources + COMMAND + fgrcc --root=${CMAKE_SOURCE_DIR} + --output-cpp-file=${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.cxx + --init-func-name=initFlightGearEmbeddedResources + --output-header-file=${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.hxx + --output-header-identifier=_FG_FLIGHTGEAR_EMBEDDED_RESOURCES + ${CMAKE_SOURCE_DIR}/src/EmbeddedResources/FlightGear-resources.xml + BYPRODUCTS + ${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.cxx + ${CMAKE_BINARY_DIR}/src/EmbeddedResources/FlightGear-resources.hxx + DEPENDS + fgrcc ${CMAKE_SOURCE_DIR}/src/EmbeddedResources/FlightGear-resources.xml +) diff --git a/src/Main/CMakeLists.txt b/src/Main/CMakeLists.txt index 61602970a..391446f73 100644 --- a/src/Main/CMakeLists.txt +++ b/src/Main/CMakeLists.txt @@ -73,6 +73,9 @@ get_property(FG_HEADERS GLOBAL PROPERTY FG_HEADERS) get_property(EMBEDDED_RESOURCE_SOURCES GLOBAL PROPERTY EMBEDDED_RESOURCE_SOURCES) get_property(EMBEDDED_RESOURCE_HEADERS GLOBAL PROPERTY EMBEDDED_RESOURCE_HEADERS) +set_source_files_properties(${EMBEDDED_RESOURCE_SOURCES} PROPERTIES GENERATED TRUE) +set_source_files_properties(${EMBEDDED_RESOURCE_HEADERS} PROPERTIES GENERATED TRUE) + # important we pass WIN32 here so the console is optional. Other # platforms ignore this option. If a console is needed we allocate # it manually via AllocConsole() @@ -87,7 +90,7 @@ add_executable(fgfs ${EMBEDDED_RESOURCE_HEADERS} ) -add_dependencies(fgfs buildId) +add_dependencies(fgfs buildId embeddedresources) # explicitly disable automoc for main fgfs target set_property(TARGET fgfs PROPERTY AUTOMOC OFF) diff --git a/test_suite/CMakeLists.txt b/test_suite/CMakeLists.txt index 859820812..89ce2d831 100644 --- a/test_suite/CMakeLists.txt +++ b/test_suite/CMakeLists.txt @@ -116,6 +116,9 @@ get_property(FG_HEADERS GLOBAL PROPERTY FG_HEADERS) get_property(EMBEDDED_RESOURCE_SOURCES GLOBAL PROPERTY EMBEDDED_RESOURCE_SOURCES) get_property(EMBEDDED_RESOURCE_HEADERS GLOBAL PROPERTY EMBEDDED_RESOURCE_HEADERS) +set_source_files_properties(${EMBEDDED_RESOURCE_SOURCES} PROPERTIES GENERATED TRUE) +set_source_files_properties(${EMBEDDED_RESOURCE_HEADERS} PROPERTIES GENERATED TRUE) + # Set up the separate executable for running the test suite. add_executable(fgfs_test_suite ${FG_SOURCES} @@ -125,7 +128,8 @@ add_executable(fgfs_test_suite ${TESTSUITE_SOURCES} ${TESTSUITE_HEADERS} ) -add_dependencies(fgfs_test_suite buildId) + +add_dependencies(fgfs_test_suite buildId embeddedresources) set_target_properties(fgfs_test_suite PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTSUITE_OUTPUT_DIR}"