out-of-source

Getting the compiler to find a Cmake-created file

六月ゝ 毕业季﹏ 提交于 2019-12-06 06:27:48
I'm using the configure_file command in Cmake in a feature availability check as described on this page . That page suggests using the command like this: configure_file(config.h.in config.h) which will translate ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in to ${CMAKE_CURRENT_BINARY_DIR}/config.h . But when I compile my program, the compiler only looks in ${CMAKE_CURRENT_SOURCE_DIR} for headers (e.g. config.h ), not in ${CMAKE_CURRENT_BINARY_DIR} . So naturally, the compiler doesn't find config.h where it was generated, and the build fails. What's the standard way to resolve this issue? Should I