Unable to set value for preprocessor variable

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:

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:
if(lvl > TEST_LOG_LEVEL)
std::cout << “level is” << (int)(TEST_LOG_LEVEL) << “\n”;

level is1

In order to get the value of a variable, you need to use a variable reference, i.e. ${<variable>}.

In your case, I guess you wanted to write:

target_compile_definitions(Tester PUBLIC