mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-30 01:25:51 +00:00
8867bb129a
And fix Windows CMake... who knows how long for.
42 lines
1.4 KiB
CMake
42 lines
1.4 KiB
CMake
CMAKE_MINIMUM_REQUIRED(VERSION 3.5 FATAL_ERROR)
|
|
|
|
# ---[ Project and semantic versioning.
|
|
PROJECT(clog C CXX)
|
|
|
|
# ---[ Options.
|
|
SET(CLOG_RUNTIME_TYPE "default" CACHE STRING "Type of runtime library (shared, static, or default) to use")
|
|
SET_PROPERTY(CACHE CLOG_RUNTIME_TYPE PROPERTY STRINGS default static shared)
|
|
IF(ANDROID)
|
|
OPTION(CLOG_LOG_TO_STDIO "Log errors, warnings, and information to stdout/stderr" OFF)
|
|
ELSE()
|
|
OPTION(CLOG_LOG_TO_STDIO "Log errors, warnings, and information to stdout/stderr" ON)
|
|
ENDIF()
|
|
|
|
MACRO(CLOG_TARGET_RUNTIME_LIBRARY target)
|
|
IF(MSVC AND NOT CLOG_RUNTIME_TYPE STREQUAL "default")
|
|
IF(CLOG_RUNTIME_TYPE STREQUAL "shared")
|
|
TARGET_COMPILE_OPTIONS(${target} PRIVATE
|
|
"/MD$<$<CONFIG:Debug>:d>")
|
|
ELSEIF(CLOG_RUNTIME_TYPE STREQUAL "static")
|
|
TARGET_COMPILE_OPTIONS(${target} PRIVATE
|
|
"/MT$<$<CONFIG:Debug>:d>")
|
|
ENDIF()
|
|
ENDIF()
|
|
ENDMACRO()
|
|
|
|
# ---[ clog library
|
|
ADD_LIBRARY(clog STATIC src/clog.c)
|
|
SET_TARGET_PROPERTIES(clog PROPERTIES
|
|
C_STANDARD 99
|
|
C_EXTENSIONS NO)
|
|
CLOG_TARGET_RUNTIME_LIBRARY(clog)
|
|
SET_TARGET_PROPERTIES(clog PROPERTIES PUBLIC_HEADER include/clog.h)
|
|
TARGET_INCLUDE_DIRECTORIES(clog BEFORE PUBLIC include)
|
|
IF(CLOG_LOG_TO_STDIO)
|
|
TARGET_COMPILE_DEFINITIONS(clog PRIVATE CLOG_LOG_TO_STDIO=1)
|
|
ELSE()
|
|
TARGET_COMPILE_DEFINITIONS(clog PRIVATE CLOG_LOG_TO_STDIO=0)
|
|
ENDIF()
|
|
IF(ANDROID AND NOT CLOG_LOG_TO_STDIO)
|
|
TARGET_LINK_LIBRARIES(clog PRIVATE log)
|
|
ENDIF() |