在我的 CMake 脚本中,我想看看我的系统上是否有一个文件,如果有的话,用它做点什么,否则就用默认文件做点什么。密码如下:
find_file(
${project_name}_${customer}_config
${ROOT}/configuration/${customer}/configuration.${project_name}.xml
)
if(NOT ${${project_name}_${customer}_config} STREQUAL
${project_name}_${customer}_config-NOTFOUND )
configure_file(${ROOT}/configuration/${customer}/configuration.${project_name}.xml
${CMAKE_CURRENT_BINARY_DIR}/conf/configuration.xml)
else()
configure_file(${FAPP_ROOT}/configuration/Default/configuration.${project_name}.xml
${CMAKE_CURRENT_BINARY_DIR}/conf/configuration.xml)
endif()
但是看起来,这不起作用。
检查 CMake 中是否存在文件的正确方法是什么?