当我使用 cmake 3.2.1 为我的项目生成 .vcxproj 时,它会生成该行<CompileAs>CompileAsCpp</CompileAs>
但是当我尝试使用 cmake 版本 3.18.1 时,生成的 .vcxproj 文件不包含前一行导致我的测试失败(代码编译)。这里是设置项目属性的 cmake 代码:
add_library(${PROJECT_NAME} SHARED ${PROJECT_SRC})
if(CMAKE_BUILD_TOOL MATCHES "(msdev|devenv|nmake|MSBuild)")
target_compile_options(${PROJECT_NAME} PRIVATE "/TP")
endif()
target_include_directories(${PROJECT_NAME} PRIVATE ${PUBLIC_INCLUDES} ${PRIVATE_INCLUDES} )
set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${PROJECT_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${PROJECT_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
set_target_properties(${PROJECT_NAME} PROPERTIES PDB_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
我如何要求 cmake 生成缺少的行 ( <CompileAs>CompileAsCpp</CompileAs>
)?谢谢你。