[cmake] make it possible to compile an individual component as static
@@ -91,11 +91,13 @@ macro(LIBRARY_PROJECT_SETUP)
# and for headers of external libraries
include_directories(${SICONOS_INCLUDE_DIRECTORIES})
- if(NOT BUILD_SHARED_LIBS)
- add_library(${COMPONENT} STATIC ${${COMPONENT}_SRCS})
- else()
+ if(BUILD_SHARED_LIBS AND NOT BUILD_${COMPONENT}_STATIC)
add_library(${COMPONENT} SHARED ${${COMPONENT}_SRCS})
+ else()
+ add_library(${COMPONENT} STATIC ${${COMPONENT}_SRCS})
+ set_property(TARGET ${COMPONENT} PROPERTY POSITION_INDEPENDENT_CODE ON)
endif()
+
list(APPEND installed_targets ${COMPONENT})
list(REMOVE_DUPLICATES installed_targets)
set(installed_targets ${installed_targets}
