I've never used cmake before, but am now forced by circumstance to port my Visual Studio 2013 OpenGL project into it. I, however, cannot seem to figure out how to link libraries (or even header only library like GLM) to it from a folder. My directory hierarchy is such:
project
|--src
|----main.cpp
|----functions.h
|----functions.cpp
|----...
|--libraries
|----GLM
|------glm (<--the include directory)
|----glew-2.0.0
|------include
|------lib
|----GLFW
|------include
|------lib-vc2013
There seems to be a lot of advice on how one should use system paths and variables to install and link such libraries, but such solutions are useless to me, as it is necessary for the libraries to be shipped together with the source files, as I cannot expect other machines to have these libraries installed or demand them to install libraries outside the project directory. I should also mention that I am using OS Windows 7.
EDIT: This is my CMakeLists.txt file where the libraries are linked:
cmake_minimum_required(VERSION 3.0)
ADD_EXECUTABLE( water_surface main.cpp functions.h functions.cpp)
TARGET_LINK_LIBRARIES(water_surface opengl32)
link_directories(
${CMAKE_SOURCE_DIR}/libraries/glew-2.0.0/lib/release/Win32
)
TARGET_LINK_LIBRARIES(water_surface glew32)
include_directories(
${CMAKE_SOURCE_DIR}/libraries/glew-2.0.0/include
)
link_directories(
${CMAKE_SOURCE_DIR}/libraries/GLFW/lib-vc2013
)
TARGET_LINK_LIBRARIES(water_surface glfw3)
include_directories(
${CMAKE_SOURCE_DIR}/libraries/GLFW/include
)
include_directories(
${CMAKE_SOURCE_DIR}/libraries/GLM/glm
)