From 2ed15eebfda6e8ca7f49ade8df99286c36e3ad72 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 22 Aug 2020 22:11:42 +0100 Subject: [PATCH] CMake fixes for Linux --- CMakeLists.txt | 5 ----- CMakeModules/AddSimGearTest.cmake | 6 +++--- CMakeModules/CheckPOSIXFeatures.cmake | 5 +++++ simgear/CMakeLists.txt | 10 +++++----- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 179ed51d..89239648 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -246,11 +246,6 @@ else() message(STATUS "Using built-in expat code") endif(SYSTEM_EXPAT) -check_include_file(inttypes.h HAVE_INTTYPES_H) -check_include_file(sys/time.h HAVE_SYS_TIME_H) -check_include_file(unistd.h HAVE_UNISTD_H) -check_include_file(windows.h HAVE_WINDOWS_H) - if(ENABLE_RTI) find_package(PkgConfig) if(PKG_CONFIG_FOUND) diff --git a/CMakeModules/AddSimGearTest.cmake b/CMakeModules/AddSimGearTest.cmake index c7e8309f..e6faebf8 100644 --- a/CMakeModules/AddSimGearTest.cmake +++ b/CMakeModules/AddSimGearTest.cmake @@ -1,7 +1,7 @@ function(add_simgear_test _name _sources) add_executable(${_name} ${_sources}) - target_link_libraries(${_name} SimGearCore) + target_link_libraries(${_name} SimGearCore Threads::Threads) # for simgear_config.h target_include_directories(${_name} PRIVATE ${PROJECT_BINARY_DIR}/simgear) @@ -10,7 +10,7 @@ endfunction() function(add_simgear_autotest _name _sources) add_executable(${_name} ${_sources}) - target_link_libraries(${_name} SimGearCore) + target_link_libraries(${_name} SimGearCore Threads::Threads) # for simgear_config.h target_include_directories(${_name} PRIVATE ${PROJECT_BINARY_DIR}/simgear) @@ -21,7 +21,7 @@ endfunction() function(add_simgear_scene_autotest _name _sources) add_executable(${_name} ${_sources}) - target_link_libraries(${_name} SimGearScene) + target_link_libraries(${_name} SimGearScene Threads::Threads) # for simgear_config.h target_include_directories(${_name} PRIVATE ${PROJECT_BINARY_DIR}/simgear) diff --git a/CMakeModules/CheckPOSIXFeatures.cmake b/CMakeModules/CheckPOSIXFeatures.cmake index 6fbbd43f..852138a4 100644 --- a/CMakeModules/CheckPOSIXFeatures.cmake +++ b/CMakeModules/CheckPOSIXFeatures.cmake @@ -4,6 +4,11 @@ check_function_exists(mkdtemp HAVE_MKDTEMP) check_function_exists(bcopy HAVE_BCOPY) check_function_exists(mmap HAVE_MMAP) +check_include_file(inttypes.h HAVE_INTTYPES_H) +check_include_file(sys/time.h HAVE_SYS_TIME_H) +check_include_file(unistd.h HAVE_UNISTD_H) +check_include_file(windows.h HAVE_WINDOWS_H) + if (NOT MSVC) check_function_exists(timegm HAVE_TIMEGM) if (NOT HAVE_TIMEGM) diff --git a/simgear/CMakeLists.txt b/simgear/CMakeLists.txt index 5d15f8b5..a70b9d7f 100644 --- a/simgear/CMakeLists.txt +++ b/simgear/CMakeLists.txt @@ -110,11 +110,6 @@ else() endforeach() add_library(SimGearScene STATIC ${sceneSources}) - - if(HAVE_INTTYPES_H) - # ShivaVG needs inttypes.h - target_compile_definitions(SimGearScene PRIVATE HAVE_INTTYPES_H) - endif() endif(NOT SIMGEAR_HEADLESS) endif(SIMGEAR_SHARED) @@ -161,6 +156,11 @@ if(NOT SIMGEAR_HEADLESS) ${OPENSCENEGRAPH_LIBRARIES} ) + if(HAVE_INTTYPES_H) + # ShivaVG needs inttypes.h + target_compile_definitions(SimGearScene PRIVATE HAVE_INTTYPES_H) + endif() + target_link_libraries(SimGearScene PRIVATE ZLIB::ZLIB ${OPENAL_LIBRARY}