Блог пользователя snorkel

Автор snorkel, история, 6 лет назад, По-английски

How can I include a header file without writing #include "header.h" for example using cmakelists.txt?

For example without writing #define DEFINE I defined it from cmakelists with the command add_definitions(-DDEFINE)

Can I do the similar thing?

  • Проголосовать: нравится
  • +6
  • Проголосовать: не нравится

»
6 лет назад, скрыть # |
← Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Depends on the compiler. E.g. GCC has -include header.h key, see docs.

You can use it in CMakeLists.txt via add_compile_options, e.g. add_compile_options(-include header.h). Note that this will include header.h in each translation unit ("source file") for all targets.

»
6 лет назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

bump