this was a response to my comment. I wrote that calling project
in a macro is not allowed, which is false.
the top-level CMakeLists.txt for CMake in project mode must follow this requirement as described in the error message (which is what i meant). A call via macro, function, include or subdirectory doesn’t violate this rule but it doesn’t meet the requirement either.
independently of the requirement, project()
can additionally be called multiple times in the same scope or anywhere else like other functions, except it cannot be before the first cmake_minimum_required
. Also, it does set various checks and enables languages so it must be used with caution.