The code.ill.fr has been recreated and upgraded with the latest version this weekend, If you encounter any problem please inform the Helpdesk.

Commit 9e5e6574 authored by Shervin Nourbakhsh's avatar Shervin Nourbakhsh
Browse files

Fixed propagation of transitive properties from object to shared and static...

Fixed propagation of transitive properties from object to shared and static libraries (link dependencies, include directories, compile features)
parent 0ebbbbf2
......@@ -12,6 +12,7 @@ function mvPack(){
#--------------- JAVA
for source_dir in cameo-server-jzmq cameo-console-jzmq
do
echo "COMPONENT: $source_dir"
build_dir=$BASE_BUILD_DIR/$source_dir
cmake -S $source_dir -B $build_dir/ || exit 1
cmake --build $build_dir || exit 1
......@@ -21,9 +22,10 @@ done
#--------------- API
#---------- C++
cmake -S cameo-api-cpp -B $BASE_BUILD_DIR/cameo-api-cpp/
cmake --build $BASE_BUILD_DIR/cameo-api-cpp/
cpack --config $BASE_BUILD_DIR/cameo-api-cpp/CPackConfig.cmake -B $BASE_BUILD_DIR/cameo-api-cpp/packaging
build_dir=$BASE_BUILD_DIR/cameo-api-cpp/
cmake -S cameo-api-cpp -B $build_dir
cmake --build $build_dir
cpack --config $build_dir/CPackConfig.cmake -B $build_dir/packaging
mvPack
#---------- Python
......
......@@ -66,12 +66,12 @@ file(GLOB_RECURSE CAMEO_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
configure_file(include/cameo.h.in ${INSTALL_INCLUDEDIR}/cameo.h )
add_library(${LIBNAME}-obj OBJECT ${CAMEO_SOURCE_FILES})
target_link_libraries(${LIBNAME}-obj PUBLIC zmq Threads::Threads)
target_link_libraries(${LIBNAME}-obj PUBLIC zmq Threads::Threads) # for some reason this is not propagated to ${LIBNAME}
target_include_directories(${LIBNAME}-obj
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src/ # all the private headers
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include> # here's the version
PUBLIC $<INSTALL_INTERFACE:${INSTALL_INCLUDEDIR}>
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_include_directories(${LIBNAME}-obj
SYSTEM PRIVATE ${Rapidjson_INCLUDE_DIRS}/
......@@ -85,23 +85,32 @@ set_target_properties(${LIBNAME}-obj PROPERTIES
)
add_library(${LIBNAME}-static STATIC $<TARGET_OBJECTS:${LIBNAME}-obj>)
add_library(${LIBNAME} $<TARGET_OBJECTS:${LIBNAME}-obj>)
set_target_properties(${LIBNAME} PROPERTIES
SOVERSION ${PROJECT_VERSION_MAJOR}
VERSION ${PROJECT_VERSION}
POSITION_INDEPENDENT_CODE 1 # this is needed for static compilation for cameo-api-python
)
add_library(${LIBNAME} $<TARGET_OBJECTS:${LIBNAME}-obj>)
add_library(${NAMESPACE}::${LIBNAME} ALIAS ${LIBNAME})
add_library(${NAMESPACE}::${LIBNAME}-obj ALIAS ${LIBNAME}-obj)
add_library(${NAMESPACE}::${LIBNAME}-static ALIAS ${LIBNAME}-static)
target_include_directories(${LIBNAME}-static
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include> # here's the version
)
target_compile_features(${LIBNAME}-static PUBLIC cxx_std_17)
target_link_libraries(${LIBNAME}-static PUBLIC zmq Threads::Threads)
target_include_directories(${LIBNAME}
SYSTEM PRIVATE ${Rapidjson_INCLUDE_DIRS}/
)
get_target_property(obj_INTERFACE_LINK_LIBRARIES ${LIBNAME}-obj INTERFACE_LINK_LIBRARIES)
get_target_property(obj_INTERFACE_COMPILE_FEATURES ${LIBNAME}-obj INTERFACE_COMPILE_FEATURES)
get_target_property(obj_INTERFACE_INCLUDE_DIRECTORIES ${LIBNAME}-obj INTERFACE_INCLUDE_DIRECTORIES)
set_target_properties(${LIBNAME} PROPERTIES
SOVERSION ${PROJECT_VERSION_MAJOR}
VERSION ${PROJECT_VERSION}
POSITION_INDEPENDENT_CODE 1 # this is needed for static compilation for cameo-api-python
INTERFACE_LINK_LIBRARIES "${obj_INTERFACE_LINK_LIBRARIES}"
INTERFACE_COMPILE_FEATURES ${obj_INTERFACE_COMPILE_FEATURES}
INTERFACE_INCLUDE_DIRECTORIES "${obj_INTERFACE_INCLUDE_DIRECTORIES}"
)
set_target_properties(${LIBNAME}-static PROPERTIES
INTERFACE_LINK_LIBRARIES "${obj_INTERFACE_LINK_LIBRARIES}"
INTERFACE_COMPILE_FEATURES "${obj_INTERFACE_COMPILE_FEATURES}"
INTERFACE_INCLUDE_DIRECTORIES "${obj_INTERFACE_INCLUDE_DIRECTORIES}"
)
#------------------------------------------------------------
......@@ -144,8 +153,7 @@ install(TARGETS ${LIBNAME}
COMPONENT ${component_development}
PUBLIC_HEADER DESTINATION ${INSTALL_INCLUDEDIR}
COMPONENT ${component_development}
INCLUDES DESTINATION ${INSTALL_INCLUDEDIR}
# COMPONENT ${component_development}
# INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
# this is to install the headers
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment