Hi all, maybe it's a silly question, but RTFM doesn't enlighten me yet:
I'd like to set the project() in a macro() defined in a file included by CMakeLists.txt. The macro get's called immediately after including() the file from within CMakeLists.txt When calling the macro cmake executes the steps in an execution order different from the case when I directly call project() instead of using the macro: When using the macro, CMake first checks for the compilers, etc. and then executes the include file. When using project() directly, CMake first executes the include file and then checks the compilers, etc. The include file is determining the tool chain depending on some configuration variables, that's why this is a problem for me. Even if the use case might be questionnable, still I'd like to understand the reason for the difference. Attached is a minimal sample to reproduce the behaviour. Any explanation? Thanks and Regards Titus
MESSAGE(STATUS "Executing global scope of CMake-Include file") MACRO(testmacro proj) MESSAGE(STATUS "Executing macro of CMake-Include file") project(${proj}) ENDMACRO()
#### CMakeFiles.txt cmake_minimum_required(VERSION 2.8) include(CMake-Include.txt) # Calling testmacro results in execution of CMake-Include.txt # after checking for the compilers. # testmacro(macroproject) # setting project directly results in immediate execution # of CMake-Include.txt project(testproject)
-- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake