I have this CMakeLists.txt file:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
CMAKE_POLICY(SET CMP0002 OLD)
PROJECT(gl_nbody C CXX)
ADD_EXECUTABLE(gl_nbody src/main.cpp)
set_target_properties(gl_nbody PROPERTIES LINKER_LANGUAGE CXX)
INCLUDE(FindPkgConfig)
PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2)
INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(gl_nbody ${SDL2_LIBRARIES})
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIRS})
target_link_libraries(gl_nbody ${OPENGL_LIBRARIES})
add_subdirectory("src")
add_subdirectory("include")
I'm not exactly sure what I am doing wrong. I have looked at this post. However, the solutions posted have not solved my issue. The output from cmake is:
-- Configuring done
CMake Error: CMake can not determine linker language for target:gl_nbody
CMake Error: Cannot determine link language for target "gl_nbody".
-- Generating done
-- Build files have been written to: /home/jared/projects/gl_nbody
Edit: I have found that the issue is due to the CMakeLists.txt file in my include directory. Here it is:
file(GLOB gl_nbody_HEADER
"*.h"
)
#add_executable(gl_nbody ${gl_nbody_HEADER})
What is strange to me is that I have a similar file in my src directory whose only difference is that it adds .cpp files instead of .h files. However, I get a link error when I try to add header files to my project.