Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

PROJECT_IS_TOP_LEVEL in test/CMakeLists.txt is not set prior to CMake 3.21 #220

Open
bgd54 opened this issue May 11, 2022 · 0 comments
Open

Comments

@bgd54
Copy link

bgd54 commented May 11, 2022

Hi! Thanks for this project!
When I use CMake 3.18 on the top level CMakeLists.txt I get the error:

[gui_starter_template]$ mkdir build
[gui_starter_template]$ cd build
[build]$ cmake ..
//...
CMake Warning (dev) at CMakeLists.txt:139 (message):
Building Tests. Be sure to check out test/constexpr_tests.cpp for
constexpr testing
This warning is for project developers. Use -Wno-dev to suppress it.

CMake Error at test/CMakeLists.txt:10 (find_package):
Could not find a package configuration file provided by "myproject" with
any of the following names:

myprojectConfig.cmake
myproject-config.cmake

Add the installation prefix of "myproject" to CMAKE_PREFIX_PATH or set
"myproject_DIR" to a directory containing one of the above files. If
"myproject" provides a separate development package or SDK, be sure it has
been installed.

-- Configuring incomplete, errors occurred!

The variable is previously set by the top level CMakeLists.txt or the last project() call (CMake 3.21+).
My understanding is that with CMake 3.21+ in test/CMakeLists.txt the project() call will set PROJECT_IS_TOP_LEVEL to OFF, while with older CMake versions the variable keeps its original value(1) from:

# This variable is set by project() in CMake 3.21+

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant