CMakeLists.txt:
cmake_minimum_required(VERSION 3.7 FATAL_ERROR)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})

include(foo)

#macro(test_project2 name target)
#    project(${name} ${ARGN})
#endmacro(test_project2)

test_project(runtime TRUE VERSION 1.0)

foo.cmake:
macro(test_project name target)
    project(${name} ${ARGN})
endmacro(test_project)

The test:
Save the two files then run "cmake ." on this CMakeLists.txt twice in 
succession.

Using cmake 3.11 or earlier: no problems
Using cmake 3.12: the second "cmake ." issues the following warning:
CMake Warning (dev) in CMakeLists.txt:
  Policy CMP0048 is not set: project() command manages VERSION variables.
  Run "cmake --help-policy CMP0048" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  The following variable(s) would be set to empty:

    CMAKE_PROJECT_VERSION
    CMAKE_PROJECT_VERSION_MAJOR
    CMAKE_PROJECT_VERSION_MINOR

That by itself is weird, but it gets better. See the "test_project2" macro in 
CMakeLists.txt? Simply uncomment it.
Even though it isn't called, uncommenting that macro causes the "Policy 
CMP0048" warning to disappear.
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

Reply via email to