Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在 CMakeLists 文件中有类似的内容:
set(CMAKE_CXX_FLAGS "-g -Wextra -DFLAG1=A")
稍后在文件中,我需要检查是否FLAG1已定义。有可能做这样的事情吗?
FLAG1
IF(${FLAG1} EQUAL A) #Do something ELSE() #Do something else ENDIF()
好吧,你可以做
set(FLAG1 A) set(CMAKE_CXX_FLAGS "-g -Wextra -DFLAG1=${FLAG1}") ... if(${FLAG1} STREQUAL A) ...