Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SofaExporter] FIX: out-of-tree include of SofaExporter header files #975

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions applications/plugins/CImgPlugin/CImgPluginConfig.cmake.in
Expand Up @@ -9,8 +9,5 @@ if(NOT TARGET CImgPlugin)
include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")
endif()

set(@PROJECT_NAME@_INCLUDE_DIRS @CMAKE_CURRENT_SOURCE_DIR@/../
@CImg_INCLUDE_DIRS@)

check_required_components(@PROJECT_NAME@)
find_package(CImg REQUIRED)
Expand Up @@ -12,6 +12,5 @@ add_definitions("-DCIMGPLUGIN_RESOURCES_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/images
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME})
target_link_libraries(${PROJECT_NAME} CImgPlugin SofaCore SofaGTestMain)
target_include_directories(${PROJECT_NAME} PRIVATE ${CImgPlugin_INCLUDE_DIRS})


4 changes: 3 additions & 1 deletion applications/plugins/CImgPlugin/CMakeLists.txt
Expand Up @@ -99,10 +99,12 @@ target_compile_options(${PROJECT_NAME} PRIVATE "-DSOFA_BUILD_CIMGPLUGIN")
target_link_libraries(${PROJECT_NAME} SofaCore ${EXTERNAL_LIBS})
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>/include")
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")
target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this is needed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it kind of is:
There's .h & .cpp files present directly in CImgPlugin dir, so if, from external code, you want to include CImgPlugin.h for instance, by typing: #include <CImgPlugin/CImgPlugin.h> you'd have to include ../ no?

target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CImg_INCLUDE_DIRS}>")
target_include_directories(${PROJECT_NAME} PUBLIC "$<INSTALL_INTERFACE:include/${PROJECT_NAME}>")

## Install rules for the library; CMake package configurations files
sofa_generate_package(NAME ${PROJECT_NAME} VERSION ${${PROJECT_NAME}_VERSION} TARGETS ${PROJECT_NAME} INCLUDE_INSTALL_DIR ${PROJECT_NAME})
sofa_generate_package(NAME ${PROJECT_NAME} VERSION ${${PROJECT_NAME}_VERSION} TARGETS ${PROJECT_NAME} INCLUDE_INSTALL_DIR ${PROJECT_NAME} INCLUDE_SOURCE_DIR "src/${PROJECT_NAME}")

if(SOFA_BUILD_TESTS)
find_package(SofaTest QUIET)
Expand Down
3 changes: 2 additions & 1 deletion modules/SofaExporter/CMakeLists.txt
Expand Up @@ -48,5 +48,6 @@ target_compile_definitions(${PROJECT_NAME} PRIVATE COMPILE_FLAGS "-DSOFA_BUILD_E
target_compile_definitions(${PROJECT_NAME} PUBLIC COMPILE_FLAGS "-DSOFA_HAVE_SOFAEXPORTER")

target_include_directories(${PROJECT_NAME} PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>")
target_include_directories(${PROJECT_NAME} PUBLIC "$<INSTALL_INTERFACE:include/${PROJECT_NAME}>")

sofa_create_package(SofaExporter ${PROJECT_VERSION} ${PROJECT_NAME} ${PROJECT_NAME})
sofa_generate_package(NAME SofaExporter VERSION ${PROJECT_VERSION} TARGETS ${PROJECT_NAME} INCLUDE_INSTALL_DIR ${PROJECT_NAME} INCLUDE_SOURCE_DIR "src/SofaExporter")
2 changes: 2 additions & 0 deletions modules/SofaExporter/SofaExporterConfig.cmake.in
Expand Up @@ -8,4 +8,6 @@ if(NOT TARGET SofaExporter)
include("${CMAKE_CURRENT_LIST_DIR}/SofaExporterTargets.cmake")
endif()

# set(@PROJECT_NAME@_INCLUDE_DIRS @CMAKE_CURRENT_SOURCE_DIR@/src/)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented ?


check_required_components(SofaExporter)