From: Stanislaw Halik Date: Wed, 2 Oct 2013 15:18:21 +0000 (+0200) Subject: fix static build with recent GNU binutils X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=fa36e94c4b56c9b5245d623d49e1bf09a8849530;p=simgear.git fix static build with recent GNU binutils Signed-off-by: Stanislaw Halik --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 2617f6e4..3bbee824 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -267,6 +267,20 @@ if(HAVE_CLOCK_GETTIME) endif(HAVE_RT) endif(HAVE_CLOCK_GETTIME) +set(DL_LIBRARY "") +check_cxx_source_compiles( + "#include + int main(void) { + return 0; + } + " + HAVE_DLFCN_H) + +if(HAVE_DLFCN_H) + check_library_exists(dl dlerror "" HAVE_DL) + set(DL_LIBRARY "dl") +endif() + SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually 'd' on windows") SET(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows") SET(CMAKE_RELWITHDEBINFO_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows") @@ -360,25 +374,17 @@ else() endif(ENABLE_TESTS) # always set TEST_LIBS as it is also used by other tools/applications -# TODO maybe better rename? -if(SIMGEAR_SHARED) - set( TEST_LIBS - SimGearCore) -else() - set( TEST_LIBS - SimGearCore - ${CMAKE_THREAD_LIBS_INIT} - ${ZLIB_LIBRARY} - ${WINSOCK_LIBRARY} - ${RT_LIBRARY} - ${CORE_SERVICES_LIBRARY}) -endif() +set(TEST_LIBS_INTERNAL_CORE + ${CMAKE_THREAD_LIBS_INIT} + ${ZLIB_LIBRARY} + ${WINSOCK_LIBRARY} + ${RT_LIBRARY} + ${DL_LIBRARY} + ${CORE_SERVICES_LIBRARY}) +set(TEST_LIBS SimGearCore ${TEST_LIBS_INTERNAL_CORE}) if(NOT SIMGEAR_HEADLESS) - set( TEST_LIBS - SimGearScene - ${TEST_LIBS} - ${OPENGL_LIBRARIES}) + set(TEST_LIBS SimGearScene ${OPENGL_LIBRARIES} ${TEST_LIBS}) endif() install (FILES ${PROJECT_BINARY_DIR}/simgear/simgear_config.h DESTINATION include/simgear/) diff --git a/simgear/CMakeLists.txt b/simgear/CMakeLists.txt index 1d1e4bcc..27f8cb3e 100644 --- a/simgear/CMakeLists.txt +++ b/simgear/CMakeLists.txt @@ -59,12 +59,6 @@ if(SIMGEAR_SHARED) set_property(TARGET SimGearCore PROPERTY VERSION ${SIMGEAR_VERSION}) set_property(TARGET SimGearCore PROPERTY SOVERSION ${SIMGEAR_SOVERSION}) - target_link_libraries(SimGearCore ${ZLIB_LIBRARY} ${RT_LIBRARY} - ${LibArchive_LIBRARIES} - ${EXPAT_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} - ${CORE_SERVICES_LIBRARY}) - if(NOT SIMGEAR_HEADLESS) add_library(SimGearScene SHARED ${sceneSources}) # set_property(TARGET SimGearScene PROPERTY FRAMEWORK 1) @@ -73,14 +67,6 @@ if(SIMGEAR_SHARED) set_property(TARGET SimGearScene PROPERTY VERSION ${SIMGEAR_VERSION}) set_property(TARGET SimGearScene PROPERTY SOVERSION ${SIMGEAR_SOVERSION}) - target_link_libraries(SimGearScene - SimGearCore - ${ZLIB_LIBRARY} - ${OPENSCENEGRAPH_LIBRARIES} - ${OPENAL_LIBRARY} - ${OPENGL_LIBRARY} - ${JPEG_LIBRARY}) - install(TARGETS SimGearScene LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) endif() @@ -133,6 +119,25 @@ else() endif(NOT SIMGEAR_HEADLESS) endif(SIMGEAR_SHARED) +target_link_libraries(SimGearCore + ${ZLIB_LIBRARY} + ${RT_LIBRARY} + ${DL_LIBRARY} + ${LibArchive_LIBRARIES} + ${EXPAT_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} + ${CORE_SERVICES_LIBRARY}) + +if(NOT SIMGEAR_HEADLESS) + target_link_libraries(SimGearScene + SimGearCore + ${ZLIB_LIBRARY} + ${OPENSCENEGRAPH_LIBRARIES} + ${OPENAL_LIBRARY} + ${OPENGL_LIBRARY} + ${JPEG_LIBRARY}) +endif() + if(ENABLE_RTI) # Ugly first aid to make hla compile agian set_property(SOURCE hla/RTI13InteractionClass.cxx hla/RTI13ObjectClass.cxx