Commit aba64aeb authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

[CMake] allow to install only interface

parent 986d05c5
......@@ -177,52 +177,54 @@ SET(${PROJECT_NAME}_SOURCES
src/version.cpp
)
ADD_LIBRARY(${PY_PROJECT_NAME} SHARED ${${PROJECT_NAME}_SOURCES} ${${PROJECT_NAME}_HEADERS})
TARGET_INCLUDE_DIRECTORIES(${PY_PROJECT_NAME}
SYSTEM PUBLIC
${Boost_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
${PYTHON_INCLUDE_DIR}
${NUMPY_INCLUDE_DIRS}
INTERFACE
#$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include> # TODO: do we really need that ?
$<INSTALL_INTERFACE:include>)
IF(SUFFIX_SO_VERSION)
SET_TARGET_PROPERTIES(${PY_PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
ENDIF(SUFFIX_SO_VERSION)
IF(NOT WIN32)
TARGET_COMPILE_OPTIONS(${PY_PROJECT_NAME} PRIVATE $<$<CXX_COMPILER_ID:MSVC>:-bigobj> "-Wno-conversion")
ELSE()
TARGET_COMPILE_OPTIONS(${PY_PROJECT_NAME} PRIVATE $<$<CXX_COMPILER_ID:MSVC>:-bigobj>)
ENDIF()
TARGET_LINK_BOOST_PYTHON(${PY_PROJECT_NAME} PUBLIC)
INSTALL(TARGETS ${PY_PROJECT_NAME}
EXPORT ${TARGETS_EXPORT_PY_NAME}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
PROJECT_INSTALL_COMPONENT(${PY_PROJECT_NAME})
ADD_HEADER_GROUP(${PROJECT_NAME}_HEADERS)
ADD_SOURCE_GROUP(${PROJECT_NAME}_SOURCES)
IF(BUILD_PYTHON_INTERFACE)
ADD_LIBRARY(${PY_PROJECT_NAME} SHARED ${${PROJECT_NAME}_SOURCES} ${${PROJECT_NAME}_HEADERS})
TARGET_INCLUDE_DIRECTORIES(${PY_PROJECT_NAME}
SYSTEM PUBLIC
${Boost_INCLUDE_DIRS}
${EIGEN3_INCLUDE_DIR}
${PYTHON_INCLUDE_DIR}
${NUMPY_INCLUDE_DIRS}
INTERFACE
#$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include> # TODO: do we really need that ?
$<INSTALL_INTERFACE:include>)
IF(SUFFIX_SO_VERSION)
SET_TARGET_PROPERTIES(${PY_PROJECT_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION})
ENDIF(SUFFIX_SO_VERSION)
IF(NOT WIN32)
TARGET_COMPILE_OPTIONS(${PY_PROJECT_NAME} PRIVATE $<$<CXX_COMPILER_ID:MSVC>:-bigobj> "-Wno-conversion")
ELSE()
TARGET_COMPILE_OPTIONS(${PY_PROJECT_NAME} PRIVATE $<$<CXX_COMPILER_ID:MSVC>:-bigobj>)
ENDIF()
TARGET_LINK_BOOST_PYTHON(${PY_PROJECT_NAME} PUBLIC)
INSTALL(TARGETS ${PY_PROJECT_NAME}
EXPORT ${TARGETS_EXPORT_PY_NAME}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_FULL_INCLUDEDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_FULL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
PROJECT_INSTALL_COMPONENT(${PY_PROJECT_NAME})
# ----------------------------------------------------
# --- PYTHON LIBRARY ---------------------------------
# ----------------------------------------------------
ADD_SUBDIRECTORY(python)
# ----------------------------------------------------
# --- UNIT TEST --------------------------------------
# ----------------------------------------------------
ADD_SUBDIRECTORY(unittest)
ENDIF()
IF(NOT INSTALL_PYTHON_INTERFACE_ONLY)
# Install package for ROS
install(FILES package.xml DESTINATION "share/${PROJECT_NAME}")
ENDIF()
# ----------------------------------------------------
# --- PYTHON LIBRARY ---------------------------------
# ----------------------------------------------------
ADD_SUBDIRECTORY(python)
# ----------------------------------------------------
# --- UNIT TEST --------------------------------------
# ----------------------------------------------------
ADD_SUBDIRECTORY(unittest)
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