无法将仅限标题的库与Clion中的CMake相关联

时间:2015-12-25 16:17:01

标签: c++ cmake cygwin clion

我现在已经在这里待了几个小时,感觉很愚蠢。有问题的库是spdlog,它只是一大堆标题。我正在使用 CMake cygwin 进行编译。

的CMakeLists.txt:

cmake_minimum_required(VERSION 3.3)
project(spdlog_test)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

include_directories(E:/Dev/libraries/spdlog)
link_directories(E:/Dev/libraries/spdlog)

set(SOURCE_FILES main.cpp)
add_executable(spdlog_test ${SOURCE_FILES})
target_link_libraries(spdlog_test spdlog)

所有路径都是正确的。

构建时

输出

/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lspdlog
collect2: error: ld returned 1 exit status
CMakeFiles/spdlog_test.dir/build.make:94: recipe for target 'spdlog_test.exe' failed
make[2]: *** [spdlog_test.exe] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/spdlog_test.dir/all' failed
make[1]: *** [CMakeFiles/spdlog_test.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

0 个答案:

没有答案