Always create only two SimGear libraries: SimGearCore and SimGearStatic, regardless of whether we're building static or shared. This requires an updated to FindSimGear.cmake module, for the static configuration.
macro(simgear_component_common name includePath sourcesList sources headers)
- if (SIMGEAR_SHARED)
+ foreach(s ${sources})
+ set_property(GLOBAL
+ APPEND PROPERTY ${sourcesList} "${CMAKE_CURRENT_SOURCE_DIR}/${s}")
+ endforeach()
- foreach(s ${sources})
- set_property(GLOBAL
- APPEND PROPERTY ${sourcesList} "${CMAKE_CURRENT_SOURCE_DIR}/${s}")
- endforeach()
-
- foreach(h ${headers})
- set_property(GLOBAL
- APPEND PROPERTY PUBLIC_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/${h}")
- endforeach()
-
- else()
- set(libName "sg${name}")
- add_library(${libName} STATIC ${sources} ${headers})
-
- install (TARGETS ${libName} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
- endif()
+ foreach(h ${headers})
+ set_property(GLOBAL
+ APPEND PROPERTY PUBLIC_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/${h}")
+ endforeach()
install (FILES ${headers} DESTINATION include/simgear/${includePath})
endmacro()
set(HEADERS compiler.h constants.h sg_inlines.h ${PROJECT_BINARY_DIR}/simgear/version.h)
install (FILES ${HEADERS} DESTINATION include/simgear/)
+get_property(coreSources GLOBAL PROPERTY CORE_SOURCES)
+get_property(sceneSources GLOBAL PROPERTY SCENE_SOURCES)
+get_property(publicHeaders GLOBAL PROPERTY PUBLIC_HEADERS)
+
+if(LIBSVN_FOUND)
+ add_definitions(${APR_CFLAGS})
+ include_directories(${LIBSVN_INCLUDE_DIR})
+endif()
+
if(SIMGEAR_SHARED)
message(STATUS "Library building mode: SHARED LIBRARIES")
- get_property(coreSources GLOBAL PROPERTY CORE_SOURCES)
- get_property(sceneSources GLOBAL PROPERTY SCENE_SOURCES)
- get_property(publicHeaders GLOBAL PROPERTY PUBLIC_HEADERS)
-
add_library(SimGearCore SHARED ${coreSources})
# set_property(TARGET SimGearCore PROPERTY FRAMEWORK 1)
set_property(TARGET SimGearCore PROPERTY SOVERSION ${SIMGEAR_SOVERSION})
target_link_libraries(SimGearCore ${ZLIB_LIBRARY} ${RT_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
- install(TARGETS SimGearCore LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(LIBSVN_FOUND)
- add_definitions(${APR_CFLAGS})
- include_directories(${LIBSVN_INCLUDE_DIR})
target_link_libraries(SimGearCore ${LIBSVN_LIBRARIES})
endif(LIBSVN_FOUND)
install(TARGETS SimGearScene LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
-
+
+ install(TARGETS SimGearCore LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
else()
message(STATUS "Library building mode: STATIC LIBRARIES")
+
+ add_library(SimGearCore STATIC ${coreSources})
+ install(TARGETS SimGearCore ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+ if(NOT SIMGEAR_HEADLESS)
+ add_library(SimGearScene STATIC ${sceneSources})
+ install(TARGETS SimGearScene ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ endif(NOT SIMGEAR_HEADLESS)
endif(SIMGEAR_SHARED)
+
+
simgear_component(bvh bvh "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS)
- if (SIMGEAR_SHARED)
- set(TEST_LIBS SimGearCore)
- else()
- set(TEST_LIBS sgbvh sgmath sgstructure sgdebug)
- endif()
-
add_executable(bvhtest bvhtest.cxx)
- target_link_libraries(bvhtest ${TEST_LIBS})
+ target_link_libraries(bvhtest SimGearCore)
add_test(bvhtest ${EXECUTABLE_OUTPUT_PATH}/bvhtest)
endif(ENABLE_TESTS)
target_link_libraries(test_metar SimGearScene)
else()
target_link_libraries(test_metar
- sgenvironment sgstructure sgmisc sgdebug
+ SimGearScene SimGearCore
${CMAKE_THREAD_LIBS_INIT}
${ZLIB_LIBRARY}
${RT_LIBRARY})
if (SIMGEAR_SHARED)
set(TEST_LIBS SimGearCore)
else()
- set(TEST_LIBS
- sgio sgbucket sgstructure sgthreads sgtiming sgmisc sgdebug
+ set(TEST_LIBS SimGearCore
${CMAKE_THREAD_LIBS_INIT}
${WINSOCK_LIBRARY}
${ZLIB_LIBRARY}
simgear_component(magvar magvar "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS)
-add_executable(test_magvar testmagvar.cxx )
-
-if (SIMGEAR_SHARED)
+ add_executable(test_magvar testmagvar.cxx )
target_link_libraries(test_magvar SimGearCore)
-else()
- target_link_libraries(test_magvar sgmagvar)
-endif()
-
endif(ENABLE_TESTS)
simgear_component(math math "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS)
-
-if (SIMGEAR_SHARED)
- set(TEST_LIBS SimGearCore)
-else()
- set(TEST_LIBS sgmath sgstructure sgdebug)
-endif()
-
-
add_executable(math_test SGMathTest.cxx)
-target_link_libraries(math_test ${TEST_LIBS})
+target_link_libraries(math_test SimGearCore)
add_test(math ${EXECUTABLE_OUTPUT_PATH}/math_test)
add_executable(geometry_test SGGeometryTest.cxx)
-target_link_libraries(geometry_test ${TEST_LIBS})
+target_link_libraries(geometry_test SimGearCore)
add_test(geometry ${EXECUTABLE_OUTPUT_PATH}/geometry_test)
endif(ENABLE_TESTS)
simgear_component(misc misc "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS)
-
-if (SIMGEAR_SHARED)
- set(TEST_LIBS SimGearCore)
-else()
- set(TEST_LIBS sgmisc sgdebug)
-endif()
-
add_executable(test_tabbed_values tabbed_values_test.cxx)
add_test(tabbed_values ${EXECUTABLE_OUTPUT_PATH}/test_tabbed_values)
-target_link_libraries(test_tabbed_values ${TEST_LIBS})
+target_link_libraries(test_tabbed_values SimGearCore)
add_executable(test_strings strutils_test.cxx )
add_test(test_strings ${EXECUTABLE_OUTPUT_PATH}/test_strings)
-target_link_libraries(test_strings ${TEST_LIBS})
+target_link_libraries(test_strings SimGearCore)
add_executable(test_path path_test.cxx )
add_test(test_path ${EXECUTABLE_OUTPUT_PATH}/test_path)
-target_link_libraries(test_path ${TEST_LIBS})
+target_link_libraries(test_path SimGearCore)
endif(ENABLE_TESTS)
simgear_component(props props "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS)
-
-if (SIMGEAR_SHARED)
- set(TEST_LIBS SimGearCore)
-else()
- set(TEST_LIBS sgprops sgxml sgstructure sgmisc sgdebug)
-endif()
-
-
add_executable(test_props props_test.cxx)
-target_link_libraries(test_props ${TEST_LIBS})
+target_link_libraries(test_props SimGearCore)
add_test(test_props ${EXECUTABLE_OUTPUT_PATH}/test_props)
add_executable(test_propertyObject propertyObject_test.cxx)
-target_link_libraries(test_propertyObject ${TEST_LIBS})
+target_link_libraries(test_propertyObject SimGearCore)
add_test(test_propertyObject ${EXECUTABLE_OUTPUT_PATH}/test_propertyObject)
endif(ENABLE_TESTS)
simgear_scene_component(tgdb scene/tgdb "${SOURCES}" "${HEADERS}")
if(ENABLE_TESTS)
-
- if (SIMGEAR_SHARED)
- set(TEST_LIBS SimGearCore)
- else()
- set(TEST_LIBS sgbucket sgmisc sgmath sgdebug)
- endif()
-
-
add_executable(BucketBoxTest BucketBoxTest.cxx)
- target_link_libraries(BucketBoxTest ${TEST_LIBS})
+ target_link_libraries(BucketBoxTest SimGearCore)
add_test(BucketBoxTest ${EXECUTABLE_OUTPUT_PATH}/BucketBoxTest)
endif(ENABLE_TESTS)
terrasync.cxx
)
-if(LIBSVN_FOUND)
- add_definitions(${APR_CFLAGS})
- include_directories(${LIBSVN_INCLUDE_DIR})
-endif()
-
simgear_component(tsync scene/tsync "${SOURCES}" "${HEADERS}")
set(SOUND_TEST_LIBS SimGearScene)
else()
set(SOUND_TEST_LIBS
- sgsound sgio sgmath sgstructure sgthreads sgtiming sgmisc sgdebug
+ SimGearScene SimGearCore
${CMAKE_THREAD_LIBS_INIT}
${RT_LIBRARY}
${OPENAL_LIBRARY}