| 1 |
add_executable(fgrcc fgrcc.cxx fgrcc.hxx) |
| 2 |
target_link_libraries(fgrcc SimGearCore) |
| 3 |
|
| 4 |
# On Windows, make sure fgrcc can be run (it needs third-party libraries) in add_custom_target |
| 5 |
if(MSVC) |
| 6 |
set_target_properties(fgrcc PROPERTIES DEBUG_POSTFIX d) |
| 7 |
if (FINAL_MSVC_3RDPARTY_DIR) |
| 8 |
set(CMAKE_MSVCIDE_RUN_PATH ${FINAL_MSVC_3RDPARTY_DIR}/bin) |
| 9 |
else() |
| 10 |
message(FATAL_ERROR "FINAL_MSVC_3RDPARTY_DIR is empty or unset") |
| 11 |
endif() |
| 12 |
endif() |
| 13 |
|
| 14 |
add_custom_command( |
| 15 |
COMMAND |
| 16 |
fgrcc --root=${PROJECT_SOURCE_DIR} |
| 17 |
--output-cpp-file=${CMAKE_CURRENT_BINARY_DIR}/FlightGear-resources.cxx |
| 18 |
--init-func-name=initFlightGearEmbeddedResources |
| 19 |
--output-header-file=${CMAKE_CURRENT_BINARY_DIR}/FlightGear-resources.hxx |
| 20 |
--output-header-identifier=_FG_FLIGHTGEAR_EMBEDDED_RESOURCES |
| 21 |
${CMAKE_CURRENT_SOURCE_DIR}/FlightGear-resources.xml |
| 22 |
OUTPUT |
| 23 |
${CMAKE_CURRENT_BINARY_DIR}/FlightGear-resources.cxx |
| 24 |
${CMAKE_CURRENT_BINARY_DIR}/FlightGear-resources.hxx |
| 25 |
MAIN_DEPENDENCY |
| 26 |
fgrcc ${CMAKE_CURRENT_SOURCE_DIR}/FlightGear-resources.xml |
| 27 |
COMMENT |
| 28 |
"Re-generating embedded resources" |
| 29 |
) |
| 30 |
|
| 31 |
# set automatically by add_custom_command? |
| 32 |
#set_source_files_properties(${EMBEDDED_RESOURCE_SOURCES} PROPERTIES GENERATED TRUE) |
| 33 |
#set_source_files_properties(${EMBEDDED_RESOURCE_HEADERS} PROPERTIES GENERATED TRUE) |
| 34 |
|
| 35 |
add_library(fgembeddedresources STATIC |
| 36 |
${CMAKE_CURRENT_BINARY_DIR}/FlightGear-resources.cxx |
| 37 |
${CMAKE_CURRENT_BINARY_DIR}/FlightGear-resources.hxx |
| 38 |
) |
| 39 |
|
| 40 |
# users of the library include this as <EmbeddedResources/FlightGear-resources.hxx> |
| 41 |
target_include_directories(fgembeddedresources INTERFACE ${PROJECT_BINARY_DIR}/src) |
| 42 |
|
| 43 |
target_link_libraries(fgembeddedresources SimGearCore) |
| 44 |
|
| 45 |
# don't try to Automoc these files, it confuses the dependency logic |
| 46 |
set_property(TARGET fgembeddedresources PROPERTY AUTOMOC OFF) |
| 47 |
|