You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fetchContent can be used in CMake scripts (cmake -P)
However, cpm.cmake manipulates some properties so this is not possible as a script.
Any way this can be fixed? (I tried commenting out setting of properties but it still fails).
The workaround I see is to define a dummy project to do the downloading, then use the path.
CMake Error at /usr/local/src/cmake-3.28.3/share/cmake-3.28/Modules/FetchContent.cmake:1188 (define_property):
define_property command is not scriptable
Call Stack (most recent call first):
/usr/local/src/cmake-3.28.3/share/cmake-3.28/Modules/FetchContent.cmake:1366:EVAL:1 (__FetchContent_declareDetails)
/usr/local/src/cmake-3.28.3/share/cmake-3.28/Modules/FetchContent.cmake:1366 (cmake_language)
util/CMakeConfig/cpm/CPM.cmake:929 (FetchContent_Declare)
util/CMakeConfig/cpm/CPM.cmake:805 (cpm_declare_fetch)
util/CMakeConfig/compiler_env.cmake:16 (cpmaddpackage)
Background:
cpm.cmake is a nice way to get dependencies, the handling of a cache outside of the build/ folder is easier to handle.
Some compilers fits in Docker, there are several variants of some other that makes it inconvenient to handle them in Docker.
So it is the natural step to try using cpm.cmake to distribute the compilers as packages (other tools are already handled).
Unfortunately, our compilers require some environment variables to be set and I have not got that working using cpm "from within" CMake configure. (Env var in CMake are not used by subshells).
The compiler must be fetched with a separate step and source the setup before the CMake configure call for the actual project.
This is actually also required for some products that are not using CMake at all, just the compiler.
The natural way would be to use a CMake script to fetch the package, source setup and then start the build.
I guess that it would be possible to use a dummy CMakeLists.txt and only run the configure phase as a workaround.
--
Edit:
Additional information: CMake 3.28.3
I get the same error with FetchContent_MakeAvailable() directly, so it may not be a CPM issue.
The text was updated successfully, but these errors were encountered:
fetchContent can be used in CMake scripts (cmake -P)
However, cpm.cmake manipulates some properties so this is not possible as a script.
Any way this can be fixed? (I tried commenting out setting of properties but it still fails).
The workaround I see is to define a dummy project to do the downloading, then use the path.
Background:
cpm.cmake is a nice way to get dependencies, the handling of a cache outside of the build/ folder is easier to handle.
Some compilers fits in Docker, there are several variants of some other that makes it inconvenient to handle them in Docker.
So it is the natural step to try using cpm.cmake to distribute the compilers as packages (other tools are already handled).
Unfortunately, our compilers require some environment variables to be set and I have not got that working using cpm "from within" CMake configure. (Env var in CMake are not used by subshells).
The compiler must be fetched with a separate step and source the setup before the CMake configure call for the actual project.
This is actually also required for some products that are not using CMake at all, just the compiler.
The natural way would be to use a CMake script to fetch the package, source setup and then start the build.
I guess that it would be possible to use a dummy CMakeLists.txt and only run the configure phase as a workaround.
--
Edit:
Additional information: CMake 3.28.3
I get the same error with FetchContent_MakeAvailable() directly, so it may not be a CPM issue.
The text was updated successfully, but these errors were encountered: