Intermediate static libs have issues.

Switch back to including the bundled expat sources directly in the
targets, since transitive linking of static libs is very awkward.
Makes static build happy again (let's see what else breaks)
This commit is contained in:
James Turner 2013-09-19 21:42:28 +01:00
parent a922aaa68e
commit 38fb9ea41e
3 changed files with 10 additions and 19 deletions

View File

@ -1,11 +1,9 @@
configure_file ( configure_file (
"${PROJECT_SOURCE_DIR}/3rdparty/expat/expat_config_cmake.in" "${PROJECT_SOURCE_DIR}/3rdparty/expat/expat_config_cmake.in"
"${PROJECT_BINARY_DIR}/3rdparty/expat/expat_config.h" "${PROJECT_BINARY_DIR}/3rdparty/expat/expat_config.h"
) )
set(expat_sources set(expat_sources
asciitab.h asciitab.h
hashtable.h hashtable.h
@ -28,15 +26,8 @@ set(expat_sources
sg_expat_external.h sg_expat_external.h
) )
foreach(s ${expat_sources})
# this code will be linked into SimGearCore shared object, so it set_property(GLOBAL
# must be compiled with -fPIC too APPEND PROPERTY LOCAL_EXPAT_SOURCES
"${CMAKE_CURRENT_SOURCE_DIR}/${s}")
endforeach()
if(SIMGEAR_SHARED AND UNIX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()
add_library(local_expat STATIC ${expat_sources})

View File

@ -232,9 +232,8 @@ else()
message(STATUS "Using built-in expat code") message(STATUS "Using built-in expat code")
add_definitions(-DHAVE_EXPAT_CONFIG_H) add_definitions(-DHAVE_EXPAT_CONFIG_H)
set(EXPAT_INCLUDE_DIRS set(EXPAT_INCLUDE_DIRS
${PROJECT_SOURCE_DIR}/3rdparty/expat ${PROJECT_SOURCE_DIR}/3rdparty/expat
${PROJECT_BINARY_DIR}/3rdparty/expat) ${PROJECT_BINARY_DIR}/3rdparty/expat)
set(EXPAT_LIBRARIES local_expat)
endif(SYSTEM_EXPAT) endif(SYSTEM_EXPAT)
include_directories(${EXPAT_INCLUDE_DIRS}) include_directories(${EXPAT_INCLUDE_DIRS})

View File

@ -45,6 +45,7 @@ install (FILES ${HEADERS} DESTINATION include/simgear/)
get_property(coreSources GLOBAL PROPERTY CORE_SOURCES) get_property(coreSources GLOBAL PROPERTY CORE_SOURCES)
get_property(sceneSources GLOBAL PROPERTY SCENE_SOURCES) get_property(sceneSources GLOBAL PROPERTY SCENE_SOURCES)
get_property(publicHeaders GLOBAL PROPERTY PUBLIC_HEADERS) get_property(publicHeaders GLOBAL PROPERTY PUBLIC_HEADERS)
get_property(localExpatSources GLOBAL PROPERTY LOCAL_EXPAT_SOURCES)
if(LIBSVN_FOUND) if(LIBSVN_FOUND)
add_definitions(${APR_CFLAGS}) add_definitions(${APR_CFLAGS})
@ -53,7 +54,7 @@ endif()
if(SIMGEAR_SHARED) if(SIMGEAR_SHARED)
message(STATUS "Library building mode: SHARED LIBRARIES") message(STATUS "Library building mode: SHARED LIBRARIES")
add_library(SimGearCore SHARED ${coreSources}) add_library(SimGearCore SHARED ${coreSources} ${localExpatSources})
# set_property(TARGET SimGearCore PROPERTY FRAMEWORK 1) # set_property(TARGET SimGearCore PROPERTY FRAMEWORK 1)
# message(STATUS "public header: ${publicHeaders}") # message(STATUS "public header: ${publicHeaders}")
@ -114,7 +115,7 @@ else()
source_group("${name}\\Headers" FILES ${g2}) source_group("${name}\\Headers" FILES ${g2})
endforeach() endforeach()
add_library(SimGearCore STATIC ${coreSources}) add_library(SimGearCore STATIC ${coreSources} ${localExpatSources})
install(TARGETS SimGearCore ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(TARGETS SimGearCore ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(NOT SIMGEAR_HEADLESS) if(NOT SIMGEAR_HEADLESS)