Hi have a library in my project that needs a preprocessor variable set with an integer value. I can define it, but not set the value. The library is in a sub directory with its own CmakeLists file. What am I missing?
Create Command:
cmake .. -DCOMPONENT_TESTS=ON -DTEST_LOG_LEVEL=5
Main cmakelists file:
option(TEST_LOG_LEVEL "Message level when logging (higher value is more verbose)" 5)
Library cmakelists file:
target_compile_definitions(Tester PUBLIC TEST_LOG_LEVEL)
In code:
#ifdef TEST_LOG_LEVEL
if(lvl > TEST_LOG_LEVEL)
{
std::cout << “level is” << (int)(TEST_LOG_LEVEL) << “\n”;
return;
}
#endif
Output:
level is1