I want to use an include() statement before I use the project() statement. But I cannot get this to work.
In my case I have a COMMAND LINE define, ie: -D CONFIG_APP_NAME=foo on the command line.
In my CMakeLists.txt file, I want to calculate the directory name before the project() invocation. This seems to not work, it seems the project() thing is executed before the include statement is executed. Are CMake files executed linearly (in order, top to bottom)? Or out of order? If so what is the order?
include ( "./${CONFIG_APP_NAME}/app_config.cmake" )
# This file defines many things I want to use later
# for example: CONFIG_APP_VERSION and CONFIG_APP_DESCRIPTION and such.
# example:
project( ${CONFIG_APP_NAME}
VERSION ${CONFIG_APP_VERSION}
DESCRIPTION ${CONFIG_APP_DESCRIPTION}
LANGUAGES C CXX ASM
)
This is important for me because I need to define application specific things in an include file of some sort that is application specific. Today I have (N=5) apps, this will grow to 20 or more soon, thus I want to move things to an APP specific CMakeLists.txt file whose location/name is calculated based on a command line define.
The alternative is to have a GIANT list of if()/else()/endif() statements in the top level CmakeLists.txt and that is messy.