Home > Blockchain >  Are CMake macros/definitions accessible from source files?
Are CMake macros/definitions accessible from source files?

Time:03-04

Are the default CMake macros/definitions exposed to the source files being build?

For instance, can I access CMAKE_PROJECT_VERSION from a main.cpp?

I understand I can just force them into the source files by creating a new macro with set() and add_compile_definitions(), but was looking for a cleaner / less redundant way of achieving this.

CodePudding user response:

No. CMake variables such as CMAKE_PROJECT_VERSION are not accessible to the source files.

  • Related