Reputation: 87
While changing to a CMake and Travis CI build environment I enabled the compilation on Travis CI. Even though the CMake project compiles correctly on my pc, Travis exited with 2:
In file included from /home/travis/build/Codestones/Proton/source/application.cpp:1:0:
/home/travis/build/Codestones/Proton/source/application.h:3:23: fatal error: glad\glad.h: No such file or directory
#include <glad\glad.h>
^
compilation terminated.
make[2]: *** [CMakeFiles/Proton.dir/source/application.cpp.o] Error 1
make[1]: *** [CMakeFiles/Proton.dir/all] Error 2
make: *** [all] Error 2
This is my CMakeLists.txt:
cmake_minimum_required(VERSION 3.1)
project(Proton)
set(CMAKE_CXX_STANDARD 11)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/source")
set(LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dependencies")
# Executable definition and properties
file(GLOB SOURCES
"${SRC_DIR}/*.h"
"${SRC_DIR}/*.cpp"
)
add_executable(Proton "${SOURCES}")
# GLFW
set(GLFW_DIR "${LIB_DIR}/glfw")
set(GLFW_BUILD_EXAMPLES OFF CACHE INTERNAL "Build the GLFW example programs")
set(GLFW_BUILD_TESTS OFF CACHE INTERNAL "Build the GLFW test programs")
set(GLFW_BUILD_DOCS OFF CACHE INTERNAL "Build the GLFW documentation")
set(GLFW_INSTALL OFF CACHE INTERNAL "Generate installation target")
add_subdirectory("${GLFW_DIR}")
target_link_libraries(${PROJECT_NAME} "glfw" "${GLFW_LIBRARIES}")
target_include_directories(${PROJECT_NAME} PRIVATE "${GLFW_DIR}/include")
target_compile_definitions(${PROJECT_NAME} PRIVATE "GLFW_INCLUDE_NONE")
# GLAD
set(GLAD_DIR "${LIB_DIR}/glad")
add_subdirectory("${GLAD_DIR}")
target_link_libraries(${PROJECT_NAME} "glad" "${GLAD_LIBRARIES}")
target_include_directories(${PROJECT_NAME} PRIVATE "${PROJECT_BINARY_DIR}/dependencies/glad/include")
I assume this means that glad.h was missing or linked incorrectly, but why would it build and run fine on my pc?
Upvotes: 1
Views: 370
Reputation: 539
gcc supports backslashes in include paths on Windows as an extension
#include <glad\glad.h>
This is not supported under linux and you should only use forward slashes /
in include paths
#include <glad/glad.h>
Upvotes: 2
Reputation: 171127
\
cannot be used as path separator in #include
directives, use /
. If your local (Windows?) compiler understands it, it's a non-portable extension.
Upvotes: 3