在使用库和 CMake 时遇到问题

Having issues with using libraries and CMake

C:\Program Files (x86)\JetBrains\CLion 1.0.1\bin\cmake\bin\cmake.exe" --build C:\Users\Anthony\.clion10\system\cmake\generated\d04e461a\d04e461a\Debug --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)

我猜第二个目标只需要删除。