Allow passing custom paths for library dependencies

master
Elias Fleckenstein 2022-04-24 17:49:13 +02:00
parent c6cf6be320
commit ea34e59565
No known key found for this signature in database
GPG Key ID: 06927A5199D6C9B2
1 changed files with 25 additions and 5 deletions

View File

@ -16,9 +16,26 @@ endif()
# Dependencies
find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED)
find_package(glfw3 3.3 REQUIRED)
find_package(Freetype REQUIRED)
if(NOT GLEW_LIBRARIES OR NOT GLEW_INCLUDE_DIRS)
find_package(GLEW REQUIRED)
endif()
if(NOT GLFW_LIBRARIES OR NOT GLFW_INCLUDE_DIRS)
find_package(glfw3 3.3 REQUIRED)
set(GLFW_LIBRARIES glfw)
set(GLFW_INCLUDE_DIRS)
endif()
if(NOT FREETYPE_LIBRARIES OR NOT FREETYPE_INCLUDE_DIRS)
find_package(Freetype REQUIRED)
endif()
if(NOT ZLIB_LIBRARIES OR NOT ZLIB_INCLUDE_DIRS)
find_package(ZLIB REQUIRED)
set(ZLIB_LIBRARIES ZLIB::ZLIB)
set(ZLIB_INCLUDE_DIRS)
endif()
# Options
@ -34,12 +51,13 @@ add_compile_options(-Wall -Wextra -Werror -Wno-address-of-packed-member -Wno-imp
link_libraries(
pthread
m
z
${ZLIB_LIBRARIES}
)
include_directories(SYSTEM ${DEPS_DIR})
include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR})
include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
include_directories(${ZLIB_INCLUDE_DIRS})
# System specific options
@ -128,11 +146,13 @@ add_executable(dragonblocks
target_link_libraries(dragonblocks
${OPENGL_LIBRARIES}
${GLEW_LIBRARIES}
glfw
${GLFW_LIBRARIES}
${FREETYPE_LIBRARIES}
)
target_include_directories(dragonblocks PUBLIC
${GLEW_INCLUDE_DIRS}
${GLFW_INCLUDE_DIRS}
${FREETYPE_INCLUDE_DIRS}
)