From 3b79530b06cf7a2b160e1f87541ef2c7ddbb36c9 Mon Sep 17 00:00:00 2001 From: Edward d'Auvergne Date: Mon, 26 Mar 2018 22:27:25 +0200 Subject: [PATCH] CMake: Split the target links and includes into separate CMake modules. --- CMakeModules/SetupFGFSIncludes.cmake | 10 ++++++++++ CMakeModules/SetupFGFSLibraries.cmake | 4 ---- src/Main/CMakeLists.txt | 6 +++++- test_suite/CMakeLists.txt | 6 +++++- 4 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 CMakeModules/SetupFGFSIncludes.cmake diff --git a/CMakeModules/SetupFGFSIncludes.cmake b/CMakeModules/SetupFGFSIncludes.cmake new file mode 100644 index 000000000..d9035ffad --- /dev/null +++ b/CMakeModules/SetupFGFSIncludes.cmake @@ -0,0 +1,10 @@ +function(setup_fgfs_includes) + if(ENABLE_JSBSIM) + # FIXME - remove once JSBSim doesn't expose private headers + include_directories(${PROJECT_SOURCE_DIR}/src/FDM/JSBSim) + endif() + + if(FG_HAVE_GPERFTOOLS) + include_directories(${GooglePerfTools_INCLUDE_DIR}) + endif() +endfunction() diff --git a/CMakeModules/SetupFGFSLibraries.cmake b/CMakeModules/SetupFGFSLibraries.cmake index 5cd109f10..ad1e85cbc 100644 --- a/CMakeModules/SetupFGFSLibraries.cmake +++ b/CMakeModules/SetupFGFSLibraries.cmake @@ -19,9 +19,6 @@ function(setup_fgfs_libraries target) endif() if(ENABLE_JSBSIM) - # FIXME - remove once JSBSim doesn't expose private headers - include_directories(${PROJECT_SOURCE_DIR}/src/FDM/JSBSim) - target_link_libraries(${target} JSBSim) endif() @@ -34,7 +31,6 @@ function(setup_fgfs_libraries target) endif() if(FG_HAVE_GPERFTOOLS) - include_directories(${GooglePerfTools_INCLUDE_DIR}) target_link_libraries(${target} ${GooglePerfTools_LIBRARIES}) endif() diff --git a/src/Main/CMakeLists.txt b/src/Main/CMakeLists.txt index 3a74aee20..243468c52 100644 --- a/src/Main/CMakeLists.txt +++ b/src/Main/CMakeLists.txt @@ -2,6 +2,7 @@ include(FlightGearComponent) include(SetupFGFSBundle) include(SetupFGFSEmbeddedResources) +include(SetupFGFSIncludes) include(SetupFGFSLibraries) include(SetupMSVCGrouping) @@ -61,6 +62,9 @@ setup_fgfs_embedded_resources() # Sort the sources and headers for MSVC. setup_msvc_grouping() +# Additional search paths for includes. +setup_fgfs_includes() + # All sources and headers to be built into fgfs. get_property(FG_SOURCES GLOBAL PROPERTY FG_SOURCES) get_property(FG_HEADERS GLOBAL PROPERTY FG_HEADERS) @@ -86,7 +90,7 @@ if(APPLE) setup_fgfs_bundle(fgfs) endif() -# Set up the target links and includes. +# Set up the target links. setup_fgfs_libraries(fgfs) if (APPLE) diff --git a/test_suite/CMakeLists.txt b/test_suite/CMakeLists.txt index f1aabab51..e8a51d07d 100644 --- a/test_suite/CMakeLists.txt +++ b/test_suite/CMakeLists.txt @@ -1,5 +1,6 @@ # CMake module includes. include(SetupFGFSEmbeddedResources) +include(SetupFGFSIncludes) include(SetupFGFSLibraries) include(SetupMSVCGrouping) @@ -82,6 +83,9 @@ setup_fgfs_embedded_resources() # Sort the sources and headers for MSVC. setup_msvc_grouping() +# Additional search paths for includes. +setup_fgfs_includes() + # All sources and headers to be built into the test suite. get_property(FG_SOURCES GLOBAL PROPERTY FG_SOURCES) get_property(FG_HEADERS GLOBAL PROPERTY FG_HEADERS) @@ -121,7 +125,7 @@ add_custom_target(test_suite COMMENT ${TEST_SUITE_COMMENT} ) -# Set up the target links and includes. +# Set up the target links. setup_fgfs_libraries(run_test_suite) # Additional libraries just for the test suite.