PROJECT_IS_TOP_LEVEL in test/CMakeLists.txt is not set prior to CMake 3.21 #220
Description
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:
gui_starter_template/CMakeLists.txt
Line 42 in 849f985