summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2019-12-23 07:44:50 +0100
committerJörg Frings-Fürst <debian@jff.email>2019-12-23 07:44:50 +0100
commit9e629c8f43b43617fa5b7d3654f7d81e81b8a427 (patch)
tree581dcb2708a7eac0bcc7bbfa6478cfa50dfcf5a8 /CMakeLists.txt
parent7bbf4ae1401bc6e40f71a32d3f97952796d85690 (diff)
parent091456e1a135d4674701a264495bd34918779391 (diff)
Merge branch 'release/debian/6.9.4-1'debian/6.9.4-1
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt43
1 files changed, 28 insertions, 15 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f3eca6b..bce888a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,28 +1,19 @@
cmake_minimum_required(VERSION 3.1)
-project(oniguruma VERSION 6.9.2)
+project(oniguruma
+ VERSION 6.9.4
+ LANGUAGES C)
set(PACKAGE onig)
set(PACKAGE_VERSION ${PROJECT_VERSION})
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
option(ENABLE_POSIX_API "Include POSIX API" ON)
-
-set(USE_CRNL_AS_LINE_TERMINATOR 0)
-set(VERSION ${PACKAGE_VERSION})
-
if(MSVC)
- # Force to always compile with W4
- if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
- string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
- else()
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
- endif()
-elseif(CMAKE_COMPILER_IS_GNUCXX)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
-elseif(CMAKE_COMPILER_IS_GNUCC)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
+ option(MSVC_STATIC_RUNTIME "Build with static runtime" OFF)
endif()
+set(USE_CRNL_AS_LINE_TERMINATOR 0)
+set(VERSION ${PACKAGE_VERSION})
include(CheckCSourceCompiles)
include(CheckIncludeFiles)
@@ -73,6 +64,28 @@ target_include_directories(onig PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
+target_compile_definitions(onig PUBLIC
+ $<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:ONIG_STATIC>)
+
+if(MSVC)
+ target_compile_options(onig PRIVATE
+ #/W4
+ )
+ if(MSVC_STATIC_RUNTIME)
+ target_compile_options(onig PRIVATE
+ $<$<CONFIG:Release>:/MT>
+ $<$<CONFIG:Debug>:/MTd>
+ $<$<CONFIG:MinSizeRel>:/MT>
+ $<$<CONFIG:RelWithDebgInfo>:/MTd>
+ )
+ endif()
+elseif(CMAKE_COMPILER_IS_GNUCC)
+ target_compile_options(onig PRIVATE
+ -Wall
+ )
+endif()
+
+
# Installation (https://github.com/forexample/package-example)
# Introduce variables: