May be using keyword NO_POLICY_SCOPE in include command will solve your problem…

From: CMake <[email protected]<mailto:[email protected]>> on behalf 
of Chuck Atkins <[email protected]<mailto:[email protected]>>
Date: Tuesday 26 April 2016 at 20:04
To: aj neu <[email protected]<mailto:[email protected]>>
Cc: "[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: Re: [CMake] project command not working, when used via macro (from an 
included file)

ajneu,

The call to project(...) needs to be explicit.  See 
https://cmake.org/cmake/help/v3.5/command/project.html:

The top-level CMakeLists.txt file for a project must contain a literal, direct 
call to the 
project()<https://cmake.org/cmake/help/v3.5/command/project.html#command:project>
 command; loading one through the 
include()<https://cmake.org/cmake/help/v3.5/command/include.html#command:include>
 command is not sufficient.

- Chuck

On Tue, Apr 26, 2016 at 1:57 PM, aj neu 
<[email protected]<mailto:[email protected]>> wrote:
Hi,

when calling `project`
...as seen here
... 
https://github.com/ajneu/cmake_project_via_macro/blob/5972c7362e11fdbaa09d9defe8cca2dcea79e606/CMakeLists.txt#L33
everything is ok.


BUT when calling `project` via a macro (that was included)
... as seen here
... 
https://github.com/ajneu/cmake_project_via_macro/blob/master/CMakeLists.txt#L33
the behaviour is not as expected.

Why?

(Details are here: https://github.com/ajneu/cmake_project_via_macro)


Is this a bug?

Thanks
ajneu


--

Powered by www.kitware.com<http://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:
http://public.kitware.com/mailman/listinfo/cmake

-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to