RSE-Texture/CMakeLists.txt

48 lines
1.4 KiB
CMake

# CMakeLists.txt
# Written by JackCarterSmith, 2020
# This code is released under the RSE license.
cmake_minimum_required(VERSION 3.1)
cmake_policy(VERSION 3.1)
# define project
project(rse-texture VERSION 1.0.1 DESCRIPTION "RogueSquadron Extractor - Texture" LANGUAGES C)
set(CMAKE_BUILD_TYPE Release)
set(RSE_TEX_NAME RSE_Texture-${PROJECT_VERSION})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/src/config.h @ONLY)
include(CheckIncludeFile)
include(CheckCSourceCompiles)
# needed packages
find_package(ZLIB REQUIRED)
include_directories(${ZLIB_INCLUDE_DIR})
find_package(PNG REQUIRED)
include_directories(${PNG_INCLUDE_DIR})
# define src/headers files
FILE(GLOB RSE_TEX_SRCS src/*.c)
FILE(GLOB RSE_TEX_HRDS src/*.h)
SOURCE_GROUP("Source Files" FILES ${RSE_TEX_SRCS})
SOURCE_GROUP("Header Files" FILES ${RSE_TEX_HRDS})
# begin building RSE-Texture
#include_directories(${CMAKE_CURRENT_SOURCE_DIR})
add_executable(rse-texture ${RSE_TEX_SRCS} ${RSE_TEX_HRDS})
set_target_properties(rse-texture PROPERTIES OUTPUT_NAME ${RSE_TEX_NAME})
if(MSVC)
# msvc does not append 'lib' - do it here to have consistent name
set_target_properties(rse-texture PROPERTIES PREFIX "lib")
set_target_properties(rse-texture PROPERTIES IMPORT_PREFIX "lib")
endif()
target_link_libraries(rse-texture ${ZLIB_LIBRARIES} ${PNG_LIBRARIES})
# install executable
install(TARGETS rse-texture
RUNTIME DESTINATION bin
)