Cmake链接错误CLion

时间:2017-08-20 02:25:33

标签: c++ cmake

我正在制作一个Nana项目,但是当我尝试在CLion中与CMake链接时,我得到了一个可能的错误 这是我的Cmake文件

project(nanaGUI)
cmake_minimum_required(VERSION 2.9)
set(CMAKE_CXX_STANDARD 17)
set(SOURCE_FILES main.cpp)
set(NANA_INCLUDE nana)
set(NANA_FILESYSTEM_FORCE 1)
set(NANA_LIBRARY_D libnana_d.a)
include_directories(Include)
add_executable(nanaGUI ${SOURCE_FILES})
#add_library(NANA_LIBRARY_D libnana_d.a)
#set (CMAKE_EXE_LINKER_FLAGS -l libnana_d.a )
target_link_libraries(nanaGUI "${NANA_LIBRARY_D}")

我收到此错误

"C:\Program Files\CMake\bin\cmake.exe" --build C:\Users\arllk\CLionProjects\nanaGUI\cmake-build-debug --target nanaGUI -- -j 2
[ 50%] Building CXX object CMakeFiles/nanaGUI.dir/main.cpp.obj
[100%] Linking CXX executable nanaGUI.exe
c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -llibnana_d
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[3]: *** [CMakeFiles\nanaGUI.dir\build.make:97: nanaGUI.exe] Error 1
mingw32-make.exe[2]: *** [CMakeFiles\Makefile2:67: CMakeFiles/nanaGUI.dir/all] Error 2
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:79: CMakeFiles/nanaGUI.dir/rule] Error 2
mingw32-make.exe: *** [Makefile:117: nanaGUI] Error 2

我看到故障在

  

找不到 -llibnana_d

但我无法避免 -l <​​/ strong>加入 libnana_d 的名称

0 个答案:

没有答案