aboutsummaryrefslogtreecommitdiffhomepage
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGravatar Alexander Grund <github@grundis.de>2020-09-28 16:39:48 +0000
committerGravatar David Tellenbach <david.tellenbach@me.com>2020-09-28 16:39:48 +0000
commita967fadb21c17622c6cdec13ad9c827054624eb4 (patch)
tree44ba3d0861831132558b799a9c4c518dc80b7934 /CMakeLists.txt
parente4b24e7fb24c280e1db096edd983ee29e255e3b8 (diff)
Make relative path variables of type STRING
When the type is PATH an absolute path is expected and user-defined values are converted into absolute paths relative to the current directory. Fixes #1990
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt13
1 files changed, 9 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f083dc3c7..a6ab9de25 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -423,22 +423,27 @@ endif()
if(EIGEN_INCLUDE_INSTALL_DIR AND NOT INCLUDE_INSTALL_DIR)
set(INCLUDE_INSTALL_DIR ${EIGEN_INCLUDE_INSTALL_DIR}
- CACHE PATH "The directory relative to CMAKE_PREFIX_PATH where Eigen header files are installed")
+ CACHE STRING "The directory relative to CMAKE_PREFIX_PATH where Eigen header files are installed")
else()
set(INCLUDE_INSTALL_DIR
"${CMAKE_INSTALL_INCLUDEDIR}/eigen3"
- CACHE PATH "The directory relative to CMAKE_PREFIX_PATH where Eigen header files are installed"
+ CACHE STRING "The directory relative to CMAKE_PREFIX_PATH where Eigen header files are installed"
)
endif()
set(CMAKEPACKAGE_INSTALL_DIR
"${CMAKE_INSTALL_DATADIR}/eigen3/cmake"
- CACHE PATH "The directory relative to CMAKE_PREFIX_PATH where Eigen3Config.cmake is installed"
+ CACHE STRING "The directory relative to CMAKE_PREFIX_PATH where Eigen3Config.cmake is installed"
)
set(PKGCONFIG_INSTALL_DIR
"${CMAKE_INSTALL_DATADIR}/pkgconfig"
- CACHE PATH "The directory relative to CMAKE_PREFIX_PATH where eigen3.pc is installed"
+ CACHE STRING "The directory relative to CMAKE_PREFIX_PATH where eigen3.pc is installed"
)
+foreach(var INCLUDE_INSTALL_DIR CMAKEPACKAGE_INSTALL_DIR PKGCONFIG_INSTALL_DIR)
+ if(IS_ABSOLUTE "${${var}}")
+ message(FATAL_ERROR "${var} must be relative to CMAKE_PREFIX_PATH. Got: ${${var}}")
+ endif()
+endforeach()
# similar to set_target_properties but append the property instead of overwriting it
macro(ei_add_target_property target prop value)