Reputation: 4617
Following this instructions, I create a headerconfig.h.in
file which contains #cmakedefine USE_MYLIB
. On my main.cpp
file i add #include headerconfig.h.in
. And, I've set too the CMakeLists.txt
file for this. But, I got this:
error: invalid preprocessing directive #cmakedefine
What did I do wrong? Is for some reason cmake
can't reade #cmakedefine
preprocessore?
Upvotes: 0
Views: 6652
Reputation: 9394
You should include not "headerconfig.h.in", but "headerconfig.h",
and add appropriate configure_file call in your cmake.
The idea is that cmake process headerconfig.h.in and generate headerconfig.h,
replace "#cmakedefine" with real values, and it uses headerconfig.h.in as template.
Upvotes: 5