[CMake] Set directory path in release mode

Arturo Caissut arturo_caissut at tiscali.it
Sat Jan 16 11:02:32 EST 2010


Hi all,
I have a little problem with a C++ project I'm writing using CMake features.
I need to define two constants in one of the header files of my
projects, I found a solution for this reading "Mastering CMake". As they
suggest I wrote a config.h.in file with pre-compiler instructions:

|#define ATLAS_TXT_PATH "@ATLAS_TXT_PATH@"
#define ATLAS_HDR_PATH "@ATLAS_HDR_PATH@"
|
and I added to my CMakeLists.txt file the following lines:

|set (ATLAS_TXT_PATH "${PROJECT_BINARY_DIR}/ProgramData/Atlas/aal.txt")
set (ATLAS_HDR_PATH "${PROJECT_BINARY_DIR}/ProgramData/Atlas/aal.hdr")

configure||_file (
"${PROJECT_SOURCE_DIR}/path_to_config_file/Config.h.in"
"${PROJECT_BINARY_DIR}/Config.h")

|
This perfectly works as long as I'm using a Debug local version of the
program I'm working at, but how can I provide the path constants to
change in order to work as well when I build a Release version of the
program, I package it and I install it to another computer?
Package CMake code is working fine, Install id good written as well, but
I need a way to define path constants to be useful when I'm installing
the program.

Could you suggest me an elegant way to do this in CMake? Maybe I should
add an IF/THEN switch to distinguish Debug building path values and
Release ones?


Bests,
Arturo


More information about the CMake mailing list