fix static build with recent GNU binutils

Signed-off-by: Stanislaw Halik <sthalik@misaki.pl>
This commit is contained in:
Stanislaw Halik 2013-10-02 17:18:21 +02:00 committed by James Turner
parent ad83e70cf5
commit fa36e94c4b
2 changed files with 42 additions and 31 deletions

View File

@ -267,6 +267,20 @@ if(HAVE_CLOCK_GETTIME)
endif(HAVE_RT) endif(HAVE_RT)
endif(HAVE_CLOCK_GETTIME) endif(HAVE_CLOCK_GETTIME)
set(DL_LIBRARY "")
check_cxx_source_compiles(
"#include <dlfcn.h>
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_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_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
SET(CMAKE_RELWITHDEBINFO_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) endif(ENABLE_TESTS)
# always set TEST_LIBS as it is also used by other tools/applications # always set TEST_LIBS as it is also used by other tools/applications
# TODO maybe better rename? set(TEST_LIBS_INTERNAL_CORE
if(SIMGEAR_SHARED)
set( TEST_LIBS
SimGearCore)
else()
set( TEST_LIBS
SimGearCore
${CMAKE_THREAD_LIBS_INIT} ${CMAKE_THREAD_LIBS_INIT}
${ZLIB_LIBRARY} ${ZLIB_LIBRARY}
${WINSOCK_LIBRARY} ${WINSOCK_LIBRARY}
${RT_LIBRARY} ${RT_LIBRARY}
${DL_LIBRARY}
${CORE_SERVICES_LIBRARY}) ${CORE_SERVICES_LIBRARY})
endif() set(TEST_LIBS SimGearCore ${TEST_LIBS_INTERNAL_CORE})
if(NOT SIMGEAR_HEADLESS) if(NOT SIMGEAR_HEADLESS)
set( TEST_LIBS set(TEST_LIBS SimGearScene ${OPENGL_LIBRARIES} ${TEST_LIBS})
SimGearScene
${TEST_LIBS}
${OPENGL_LIBRARIES})
endif() endif()
install (FILES ${PROJECT_BINARY_DIR}/simgear/simgear_config.h DESTINATION include/simgear/) install (FILES ${PROJECT_BINARY_DIR}/simgear/simgear_config.h DESTINATION include/simgear/)

View File

@ -59,12 +59,6 @@ if(SIMGEAR_SHARED)
set_property(TARGET SimGearCore PROPERTY VERSION ${SIMGEAR_VERSION}) set_property(TARGET SimGearCore PROPERTY VERSION ${SIMGEAR_VERSION})
set_property(TARGET SimGearCore PROPERTY SOVERSION ${SIMGEAR_SOVERSION}) 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) if(NOT SIMGEAR_HEADLESS)
add_library(SimGearScene SHARED ${sceneSources}) add_library(SimGearScene SHARED ${sceneSources})
# set_property(TARGET SimGearScene PROPERTY FRAMEWORK 1) # 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 VERSION ${SIMGEAR_VERSION})
set_property(TARGET SimGearScene PROPERTY SOVERSION ${SIMGEAR_SOVERSION}) 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}) install(TARGETS SimGearScene LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif() endif()
@ -133,6 +119,25 @@ else()
endif(NOT SIMGEAR_HEADLESS) endif(NOT SIMGEAR_HEADLESS)
endif(SIMGEAR_SHARED) 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) if(ENABLE_RTI)
# Ugly first aid to make hla compile agian # Ugly first aid to make hla compile agian
set_property(SOURCE hla/RTI13InteractionClass.cxx hla/RTI13ObjectClass.cxx set_property(SOURCE hla/RTI13InteractionClass.cxx hla/RTI13ObjectClass.cxx