Skip to content
This repository was archived by the owner on Apr 19, 2023. It is now read-only.
This repository was 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

Description

@bgd54

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+

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions