使用库和CMake有问题
Having issues with using libraries and CMake
C:Program Files (x86)JetBrainsCLion 1.0.1bincmakebincmake.exe" --build C:UsersAnthony.clion10systemcmakegeneratedd04e461ad04e461aDebug --target all -- -j 8
-- Configuring incomplete, errors occurred!
CMake Error at CMakeLists.txt:19 (add_library):
See also "C:/Users/Anthony/.clion10/system/cmake/generated/d04e461a/d04e461a/Debug/CMakeFiles/CMakeOutput.log".
add_library cannot create target "Majick" because another target with the
same name already exists. The existing target is an executable created in
source directory "C:/Users/Anthony/ClionProjects/Majick". See
documentation for policy CMP0002 for more details.
Makefile:163: recipe for target 'cmake_check_build_system' failed
mingw32-make.exe: *** [cmake_check_build_system] Error 1
我做这件事有很多问题,是我的错。我一点也不明白。我想,习惯了方便的链接已经害死了我。这是我有的。
cmake_minimum_required(VERSION 3.2)
project(Majick)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
find_package(OpenGL REQUIRED)
#add_subdirectory(C:/Users/Anthony/ClionProjects/glfw Majick/glfw)
#add_subdirectory(C:/Users/Anthony/ClionProjects/glm Majick/glm)
#add_subdirectory(C:/Users/Anthony/ClionProjects/glew Majick/glew)
set(SOURCE_FILES main.cpp)
add_executable(Majick ${SOURCE_FILES})
include_directories(${OPENGL_INCLUDE_DIRS} ${GLFW_INCLUDE_DIRS} ${GLM_INCLUDE_DIRS} ${GLEW_INCLUDE_DIRS})
link_directories(C:/Users/Anthony/ClionProjects/glew/lib/Release/x64 C:/Users/Anthony/ClionProjects/glfw/lib-mingw)
target_link_libraries(Majick ${OPENGL_LIBRARIES} ${GLFW_LIBRARIES} ${GLEW_LIBRARIES} glfw3 glew32s opengl32)
add_library(Majick STATIC)
这让我觉得自己很蠢,但我不知道发生了什么。我花了五个小时左右的时间在谷歌上搜索,但一无所获。有没有人介意帮我解决我的问题,也许提供一些地方,我可以得到更多的信息在CMake? 错误信息非常清楚:有两个具有相同名称的目标,这在CMake中是不可能的。
add_executable(Majick ${SOURCE_FILES})
...
add_library(Majick STATIC)
我想第二个目标应该被删除了
相关文章:
- 我似乎对if/else的基本语句有问题:/
- 我在范围内未声明的错误类有问题
- 我的C++语言蛮力算法有问题
- 我关于函数"Assert"的C++代码有问题
- 标准对此指向成员函数类型模板参数有何说明?是我的代码有误,还是 MSVS 16.6 有问题?
- C++类中的友元函数有问题?
- 我对数组即 0x6dfe78 有问题
- 我对 std::unique(算法)C++有问题
- 使用 fstream 库并在屏幕上打印的文件有问题?
- 这个模板为什么有问题?如何正确编译
- 我对 MyGraph 属性顶点名称和边权重有问题
- delete[]有问题,如何部分删除内存
- 在C++中使用exit()退出程序有问题吗
- 跳转到if(false)块有问题吗
- 查找有问题的宏
- 使用 rand() 和 srand() 有问题
- C++ 回文程序总是给出 0(假)作为输出问题;我的代码哪里有问题?
- 我在 C++ "out_of_range at memory location"有问题
- 我在 c++ 中的 AES 代码有问题。明文正在更改,但加密邮件是相同的。我找不到我的错误
- 使用库和CMake有问题