project(Brendan-C-SFML)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "$ENV{SFML_ROOT}/cmake/Modules")
find_package(SFML REQUIRED COMPONENTS main system window graphics audio)
add_executable(Brendan-C-SFML brendan-c.cpp)
target_include_directories(Brendan-C-SFML PRIVATE ${SFML_INCLUDE_DIR})
target_link_libraries(Brendan-C-SFML ${SFML_LIBRARIES})
我有一个share
文件夹,该文件夹应与Brendan-C-SFML.exe
位于同一目录中,但CLion会构建非源代码,因此无法访问share
。有没有办法设置CLion将share
复制到构建目录?
答案 0 :(得分:6)
将以下行添加到CMakeLists.txt
。
file(COPY share DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
尝试重新加载cmake
配置,以防副本无效。使用File -> Reload CMake Project
重新加载cmake配置。