Skip to content

Commit ec9586d

Browse files
authored
Merge pull request #1809 from BDoignies/NoInstall
Option not to install targets
2 parents c3da8b2 + 40e195e commit ec9586d

File tree

4 files changed

+43
-32
lines changed

4 files changed

+43
-32
lines changed

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/deps)
3737
set(DGtal_VERSION_MAJOR ${CMAKE_PROJECT_VERSION_MAJOR})
3838
set(DGtal_VERSION_MINOR ${CMAKE_PROJECT_VERSION_MINOR})
3939
set(DGtal_VERSION_PATCH ${CMAKE_PROJECT_VERSION_PATCH})
40-
set(DGTAL_VERSION ${CMAKE_PROJECT_VERSION})
4140
set(PROJECT_VERSION ${CMAKE_PROJECT_VERSION})
4241
set(VERSION ${CMAKE_PROJECT_VERSION})
4342

ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
- Version is now extracted from the `VERSION` file for CMake and Python builds (Bastien Doignies, [#1810](https://github.com/DGtal-team/DGtal/pull/1810))
2222
- Replacing the global compilation flags when `DGTAL_WARNINGS_AS_ERRORS` is set, with per target `target_compile_options` to avoid errors on Boost warnings (David Coeurjolly, [#1793](https://github.com/DGtal-team/DGtal/pull/1793))
2323
- Fixing the `make install` command for boost (issue #1794) (Bastien Doignies, [#1793](https://github.com/DGtal-team/DGtal/pull/1793))
24+
- Adding option not to install targets to avoid crashes when boost is fetched through multiple channels ([#1809](https://github.com/DGtal-team/DGtal/pull/1809))
2425
- Cleaning up the Github Actions reuses (Bastien Doignies, [#1793](https://github.com/DGtal-team/DGtal/pull/1793))
2526
- Add cache to github actions (Bastien Doignies, [#1805](https://github.com/DGtal-team/DGtal/pull/1805))
2627

cmake/Common.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -- Messages
33
#------------------------------------------------------------------------------
44
message(STATUS "-------------------------------------------------------------------------------")
5-
message(STATUS "DGtal Version ${PROJECT_VERSION}")
5+
message(STATUS "DGtal Version ${DGTAL_VERSION}")
66
message(STATUS "-------------------------------------------------------------------------------" )
77
message(STATUS "Source DIR is ${PROJECT_SOURCE_DIR}")
88
message(STATUS "Binary/Build DIR is ${PROJECT_BINARY_DIR}")

cmake/Install.cmake

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,47 @@
1-
#------------------------------------------------------------------------------
2-
# DGtal Configuration file for the install target
3-
#------------------------------------------------------------------------------
41
include(CMakePackageConfigHelpers)
52
set(DGTAL_INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/DGtal")
63

7-
install(TARGETS
4+
# On system where boost is fetched through multiples sources, there can
5+
# be some confusion as to which version is linked.
6+
# For some unknown reason, DGtal can be linked with targets not declared
7+
# within this project, thus not necessarly in the export set; causing
8+
# CMake to issue an error.
9+
# We tried fixing this in multiples ways but none of them but no parameters
10+
# that can be passed to CMake worked.
11+
# We therefore add a mecanism to disable install/export targets (note that
12+
# other file might be required) that resolves the problem, although this is quite ugly...
13+
option(DGTAL_ENABLE_TARGET_INSTALL "Enable DGtal file installation" ON)
14+
if (${DGTAL_ENABLE_TARGET_INSTALL})
15+
#------------------------------------------------------------------------------
16+
# DGtal Configuration file for the install target
17+
#------------------------------------------------------------------------------
18+
install(TARGETS
819
DGtal
9-
# Dependancies also built by the project
10-
DGtal_STB DGTAL_LibBoard DGTAL_BoostAddons
11-
EXPORT DGtalTargets
12-
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
13-
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
14-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
15-
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
16-
)
17-
18-
# Export file locally also, so the DGtalConfig.cmake
19-
# in the build/ directory can work
20-
export(TARGETS
20+
# Dependancies also built by the project
21+
DGtal_STB DGTAL_LibBoard DGTAL_BoostAddons
22+
EXPORT DGtalTargets
23+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
24+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
25+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
26+
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
27+
)
28+
# Export file locally also, so the DGtalConfig.cmake
29+
# in the build/ directory can work
30+
export(TARGETS
2131
DGtal
22-
# Dependancies also built by the project
23-
DGtal_STB DGTAL_LibBoard DGTAL_BoostAddons
24-
NAMESPACE DGtal::
25-
FILE DGtalTargets.cmake
26-
)
32+
# Dependancies also built by the project
33+
DGtal_STB DGTAL_LibBoard DGTAL_BoostAddons
34+
NAMESPACE DGtal::
35+
FILE DGtalTargets.cmake
36+
)
37+
38+
install(EXPORT DGtalTargets
39+
FILE DGtalTargets.cmake
40+
NAMESPACE DGtal::
41+
DESTINATION ${DGTAL_INSTALL_DESTINATION}
42+
)
43+
endif()
44+
2745

2846
# Install headers
2947
# Note : this also copies a few .cpp and CMakeLists but simplifies the code here
@@ -45,14 +63,6 @@ install(FILES
4563
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/DGtal/topology/tables/
4664
)
4765

48-
49-
install(EXPORT DGtalTargets
50-
FILE DGtalTargets.cmake
51-
NAMESPACE DGtal::
52-
DESTINATION ${DGTAL_INSTALL_DESTINATION}
53-
)
54-
55-
5666
#------------------------------------------------------------------------------
5767
# DGtalConfig.cmake variables
5868
#------------------------------------------------------------------------------
@@ -75,9 +85,10 @@ foreach(dep ${_dependencies_list})
7585
endif()
7686
endforeach()
7787

88+
message("DGtal version = ${DGTAL_VERSION}")
7889
write_basic_package_version_file(
7990
"${CMAKE_CURRENT_BINARY_DIR}/DGtalConfigVersion.cmake"
80-
VERSION "${version}"
91+
VERSION "${DGTAL_VERSION}"
8192
COMPATIBILITY AnyNewerVersion
8293
)
8394

0 commit comments

Comments
 (0)