-
configure_file (
"${PROJECT_SOURCE_DIR}/3rdparty/expat/expat_config_cmake.in"
"${PROJECT_BINARY_DIR}/3rdparty/expat/expat_config.h"
)
-
set(expat_sources
asciitab.h
hashtable.h
sg_expat_external.h
)
-
-# this code will be linked into SimGearCore shared object, so it
-# must be compiled with -fPIC too
-
-
-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})
-
+foreach(s ${expat_sources})
+ set_property(GLOBAL
+ APPEND PROPERTY LOCAL_EXPAT_SOURCES
+ "${CMAKE_CURRENT_SOURCE_DIR}/${s}")
+endforeach()
message(STATUS "Using built-in expat code")
add_definitions(-DHAVE_EXPAT_CONFIG_H)
set(EXPAT_INCLUDE_DIRS
- ${PROJECT_SOURCE_DIR}/3rdparty/expat
- ${PROJECT_BINARY_DIR}/3rdparty/expat)
- set(EXPAT_LIBRARIES local_expat)
+ ${PROJECT_SOURCE_DIR}/3rdparty/expat
+ ${PROJECT_BINARY_DIR}/3rdparty/expat)
endif(SYSTEM_EXPAT)
include_directories(${EXPAT_INCLUDE_DIRS})
get_property(coreSources GLOBAL PROPERTY CORE_SOURCES)
get_property(sceneSources GLOBAL PROPERTY SCENE_SOURCES)
get_property(publicHeaders GLOBAL PROPERTY PUBLIC_HEADERS)
+get_property(localExpatSources GLOBAL PROPERTY LOCAL_EXPAT_SOURCES)
if(LIBSVN_FOUND)
add_definitions(${APR_CFLAGS})
if(SIMGEAR_SHARED)
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)
# message(STATUS "public header: ${publicHeaders}")
source_group("${name}\\Headers" FILES ${g2})
endforeach()
- add_library(SimGearCore STATIC ${coreSources})
+ add_library(SimGearCore STATIC ${coreSources} ${localExpatSources})
install(TARGETS SimGearCore ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(NOT SIMGEAR_HEADLESS)