RSE-Terrain/RSETerrain/CMakeLists.txt

50 lines
1.6 KiB
CMake

# CMakeLists.txt
####################################################
# Written by JackCarterSmith, 2022
# This code is released under the RSE license.
####################################################
# General configuration
include(CheckIncludeFile)
include(CheckCSourceCompiles)
add_definitions(-DCONF_NO_GL) # Used for obj-lib to not compile GL part
# Import needed packages and references their include path
find_package(ZLIB 1.2.12 REQUIRED)
include_directories(${ZLIB_INCLUDE_DIR})
find_package(PNG 1.6.37 REQUIRED)
include_directories(${PNG_INCLUDE_DIR})
#find_package(GLEW REQUIRED) # Enable when GL rendering is ready
#include_directories(${GLEW_INCLUDE_DIR})
# Define src/headers files
file(GLOB_RECURSE RSE_TERRAIN_SOURCES ./src/*.c)
source_group("Source Files" FILES ${RSE_TERRAIN_SOURCES})
# Building instructions for RSE-Terrain
if(DEFINED ENV{CI})
set(CMAKE_BUILD_TYPE RELEASE)
endif()
# Declare standalone application
add_executable(rse-terrain ${RSE_TERRAIN_SOURCES})
set_property(TARGET rse-terrain PROPERTY C_STANDARD 90)
#target_include_directories(rse-terrain PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
set_target_properties(rse-terrain PROPERTIES OUTPUT_NAME ${RSE_TERRAIN_NAME})
# Link externals libraries to the linker
if(MSVC)
# msvc does not append 'lib' - do it here to have consistent name
set_target_properties(rse-terrain PROPERTIES IMPORT_PREFIX "lib")
target_link_libraries(rse-terrain PRIVATE rsp-terrain-libstatic ${ZLIB_LIBRARIES} ${PNG_LIBRARIES} ${GLEW_LIBRARIES})
else()
target_link_libraries(rse-terrain PRIVATE rsp-terrain-libstatic ${ZLIB_LIBRARIES} ${PNG_LIBRARIES} ${GLEW_LIBRARIES} m)
endif()