Reputation: 411
This is a follow-up question to one that I asked previously, which if it pleases you may be found here. To summarize, I have been trying to understand the build process for linking necessary libraries into OpenGL. I am aware that there are boilerplates and other methods that make this process easier; I am interested in being able to do so autonomously.
My issue is that although CMake sucessfully processes my CMakeLists.txt file, the resulting Makefile throws an error. If helpful, my file structure is contextualized here:
+ infuriating_project
+ bin // post compile results
+ src // my humble code
+ deps // external code
+glew
+ include
+ src
+glfw
+ include
+ src
+glm
+soil
+ lib
+ src
Here are the contents of my CMakeLists.txt file:
cmake_minimum_required (VERSION 3.0)
# Version Information ---------------------------------------------------------
project (openGL-practice)
SET (VERSION_MAJOR 1)
SET (VERSION_MINOR 0)
SET (VERSION_FEATURE 0)
SET (VERSION_PATCH 0)
SET (VERSION "${VERSION_MAJOR}.${VERSION_MINOR}")
SET (VERSION "${VERSION}.${VERSION_FEATURE}.${VERSION_PATCH}")
MESSAGE ("Version: ${VERSION}")
# Configure Binary Directories ------------------------------------------------
SET (PROJECT_BINARY_DIR "${PROJECT_BINARY_DIR}/bin")
MESSAGE ("Source path: ${PROJECT_SOURCE_DIR}")
MESSAGE ("Binary path: ${PROJECT_BINARY_DIR}")
# Configure Depenency Directories ---------------------------------------------
SET (deps "${PROJECT_SOURCE_DIR}/deps")
MESSAGE ("Dependencies path: ${deps}")
SET (glew_inc "${deps}/glew/include/GL/")
SET (glew_src "${deps}/glew/src/")
SET (glfw_inc "${deps}/glfw/include/GLFW/")
SET (glfw_src "${deps}/glfw/src/")
SET (glm "${deps}/glm/glm/")
SET (soil_lib "${deps}/lib/")
SET (soil_src "${deps}/src/")
# Include directories ---------------------------------------------------------
include_directories("
${PROJECT_SOURCE_DIR}
${glew_inc}
${glew_src}
${glfw_inc}
${glfw_src}
${glm}
${soil_lib}
${soil_src}
")
# Add executable --------------------------------------------------------------
add_executable(main ${PROJECT_SOURCE_DIR}/src/main.cpp)
Upon completion, I get the following error when running make:
CMakeFiles/main.dir/flags.make:10: *** missing separator. Stop.
make[1]: *** [CMakeFiles/main.dir/all] Error 2
make: *** [all] Error 2
My investigations of this error have led me to believe that there is a syntax error, likely a tabs vs spaces error as indicated here. I am sure that this is an issue on my behalf, and not a bug in CMake. I am confident that there should be a way to alter my CMakeLists file such that this issue does not occur.
The Makefile is a bit lengthy for this already lengthy post. If it would be helpful for me to upload it, I can edit this question with that information. Thank you very much in advance for any and all help or advice.
Upvotes: 0
Views: 844
Reputation: 100936
This is wrong:
include_directories("
${PROJECT_SOURCE_DIR}
${glew_inc}
${glew_src}
${glfw_inc}
${glfw_src}
${glm}
${soil_lib}
${soil_src}
")
Do not quote this as one long string: cmake will try to provide this string (including newlines) as the argument to -I
in your compiler.
Use:
include_directories(
${PROJECT_SOURCE_DIR}
${glew_inc}
${glew_src}
${glfw_inc}
${glfw_src}
${glm}
${soil_lib}
${soil_src}
)
Or, quote each path individually if you want to.
Upvotes: 1