[CMake] Cache variables from module
Florian Lindner
mailinglists at xgm.de
Thu May 3 03:36:03 EDT 2018
Hello,
I have a third party FindPETSc.cmake module:
https://github.com/jedbrown/cmake-modules/blob/master/FindPETSc.cmake
The problem I have, is that variable PETSC_VERSION is not set when cmake is run for a second time
https://github.com/jedbrown/cmake-modules/issues/28
What is best way to deal with that?
Can an entire function be cached, e.g. petsc_get_version or is adding CACHE to the set calls of PETSC_VERSION the best way?
Adding CACHE INTERNAL gives me error messages:
set (PETSC_VERSION "${PETSC_VERSION_MAJOR}.${PETSC_VERSION_MINOR}.${PETSC_VERSION_SUBMINOR}" CACHE INTERNAL "PETSc
version" PARENT_SCOPE)
CMake Error at tools/cmake-modules/FindPETSc.cmake:314 (if):
if given arguments:
"3.8.4" "CACHE" "INTERNAL" "PETSc version" "VERSION_LESS" "3.1"
Unknown arguments specified
Thanks!
Florian
More information about the CMake
mailing list