You have your own cmake c++ project, you need to create a compilation key and get information about it in the code.
I need something like this.
in CmakeLists.txt:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -myTest")
in *.cpp
if(KEY == "myTest"){
// testing code.
}