summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt163
1 files changed, 30 insertions, 133 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d9d99ba..26030fa 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,138 +1,35 @@
-cmake_minimum_required(
- VERSION
- 3.20
-)
-project(
- u8c
- VERSION
- 27
- DESCRIPTION
- "Unicode manipulation library."
- HOMEPAGE_URL
- "https://mandelbrot.dk/delta/u8c"
- LANGUAGES
- CXX
-)
-set(
- CMAKE_CXX_STANDARD
- 23
-)
-set(
- CMAKE_CXX_EXTENSIONS
- OFF
-)
+#
+# Copyright 2021, 2023 Gabriel Bjørnager Jensen.
+#
+# This file is part of u8c.
+#
+# u8c is free software: you can redistribute it
+# and/or modify it under the terms of the GNU
+# Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of
+# the License, or (at your option) any later
+# version.
+#
+# u8c is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even
+# the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU
+# Lesser General Public License along with u8c. If
+# not, see <https://www.gnu.org/licenses/>.
+#
-# Options:
-option(
- U8C_TEST
- "Build test program."
- OFF
-)
+cmake_minimum_required(VERSION 3.21)
-# Disable in-souce builds:
-if(
- "${PROJECT_BINARY_DIR}"
- STREQUAL
- "${PROJECT_SOURCE_DIR}"
-)
- message(
- FATAL_ERROR
- "In-source building is not allowed."
- )
-endif()
-
-# Compiler Settings:
-message(
- STATUS
- "Enabling colour output for Clang or GCC..."
-)
-if(
- "${CMAKE_CXX_COMPILER_ID}"
- STREQUAL
- "Clang"
-)
- add_compile_options(
- "-fcolor-diagnostics"
- )
-elseif(
- "${CMAKE_CXX_COMPILER_ID}"
- STREQUAL
- "GNU"
-)
- add_compile_options (
- "-fdiagnostics-color=always"
- )
-endif()
-message(
- STATUS
- "Enabling compile warnings..."
-)
-if(
- MSVC
-)
- add_compile_options(
- "/W4"
- "/WX"
- )
-else()
- add_compile_options(
- "-Wfatal-errors"
- "-Wall"
- "-Werror"
- "-Wextra"
- "-Wno-attributes"
- "-pedantic-errors"
- )
-endif()
-if(
- CMAKE_BUILD_TYPE
- MATCHES
- Release
-)
- message(
- STATUS
- "Setting optimisation level..."
- )
- if(
- MSVC
- )
- add_compile_options(
- "/Os"
- )
- else()
- add_compile_options(
- "-Os"
- )
- endif()
-endif()
-include_directories(
- "${PROJECT_SOURCE_DIR}/u8c/include"
-)
-
-# u8c settings:
-add_library(
+project(
u8c
- SHARED
- "u8c/src/operator.cc"
- "u8c/src/u8c/fmt.cc"
- "u8c/src/u8c/print.cc"
- "u8c/src/u8c/println.cc"
+ VERSION 29
+ DESCRIPTION "Unicode for C."
+ HOMEPAGE_URL "https://mandelbrot.dk/u8c"
+ LANGUAGES C CXX
)
-# Test settings:
-if(
- U8C_TEST
-)
- add_executable(
- test
- "u8c-check/src/test.cc"
- )
- add_dependencies(
- test
- u8c
- )
- target_link_libraries(
- test
- u8c
- )
-endif()
+add_subdirectory(u8c)
+add_subdirectory(u8c-check)