Skip to content

Commit a967fad

Browse files
Flamefiredtellenbach
authored andcommitted
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
1 parent e4b24e7 commit a967fad

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

CMakeLists.txt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,22 +423,27 @@ endif()
423423

424424
if(EIGEN_INCLUDE_INSTALL_DIR AND NOT INCLUDE_INSTALL_DIR)
425425
set(INCLUDE_INSTALL_DIR ${EIGEN_INCLUDE_INSTALL_DIR}
426-
CACHE PATH "The directory relative to CMAKE_PREFIX_PATH where Eigen header files are installed")
426+
CACHE STRING "The directory relative to CMAKE_PREFIX_PATH where Eigen header files are installed")
427427
else()
428428
set(INCLUDE_INSTALL_DIR
429429
"${CMAKE_INSTALL_INCLUDEDIR}/eigen3"
430-
CACHE PATH "The directory relative to CMAKE_PREFIX_PATH where Eigen header files are installed"
430+
CACHE STRING "The directory relative to CMAKE_PREFIX_PATH where Eigen header files are installed"
431431
)
432432
endif()
433433
set(CMAKEPACKAGE_INSTALL_DIR
434434
"${CMAKE_INSTALL_DATADIR}/eigen3/cmake"
435-
CACHE PATH "The directory relative to CMAKE_PREFIX_PATH where Eigen3Config.cmake is installed"
435+
CACHE STRING "The directory relative to CMAKE_PREFIX_PATH where Eigen3Config.cmake is installed"
436436
)
437437
set(PKGCONFIG_INSTALL_DIR
438438
"${CMAKE_INSTALL_DATADIR}/pkgconfig"
439-
CACHE PATH "The directory relative to CMAKE_PREFIX_PATH where eigen3.pc is installed"
439+
CACHE STRING "The directory relative to CMAKE_PREFIX_PATH where eigen3.pc is installed"
440440
)
441441

442+
foreach(var INCLUDE_INSTALL_DIR CMAKEPACKAGE_INSTALL_DIR PKGCONFIG_INSTALL_DIR)
443+
if(IS_ABSOLUTE "${${var}}")
444+
message(FATAL_ERROR "${var} must be relative to CMAKE_PREFIX_PATH. Got: ${${var}}")
445+
endif()
446+
endforeach()
442447

443448
# similar to set_target_properties but append the property instead of overwriting it
444449
macro(ei_add_target_property target prop value)

0 commit comments

Comments
 (0)