[CMake] Dependencies when using macro as include filename

Max Vasin max.vasin at gmail.com
Fri Sep 16 07:29:24 EDT 2011


Hello,
I have a number of headers (say A.h, B.h, C.h) that define some kind
of hardware abstraction layer, which header to use is determined
by the CMakeLists.txt and specified by the macro in config.h:

config.h:
#cmakedefine HAL_H ${HAL_H}

The config.h and the HAL_H are included by the header (say P.h).

P.h:
#include "config.h"
#include HAL_H

When I modify the HAL_H only the program is not rebuilt. I do not what
to make condition includes like

P.h:
#if NEED_A_H
#  include "A.h"
#elseif NEED_B_H
#  include "B.h"
// etc.

because I what to have all these condition in CMakeLists.txt only and
keep P.h simple and straightforward.
I understand that I can generate P.h with CONFIGURE_FILE but I wonder
if there are other solutions and which
solution the community recommends.

-- 
WBR,
Max Vasin.


More information about the CMake mailing list