From f8d063101c6ccb261a1c170e012de6dd86ff7f55 Mon Sep 17 00:00:00 2001 From: yanyiwu Date: Sat, 27 Jul 2024 19:24:57 +0800 Subject: [PATCH] [CMake] mini_required 2.6->3.5 and fix CXX_VERSION variable passed from cmd --- CMakeLists.txt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5da2ec9d..a0dc71ad 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,6 @@ +CMAKE_MINIMUM_REQUIRED (VERSION 3.5) PROJECT(CPPJIEBA) -CMAKE_MINIMUM_REQUIRED (VERSION 2.6) - INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/deps/limonp/include ${PROJECT_SOURCE_DIR}/include) @@ -9,12 +8,14 @@ if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set (CMAKE_INSTALL_PREFIX "/usr/local/cppjieba" CACHE PATH "default install path" FORCE ) endif() -ADD_DEFINITIONS(-O3 -Wall -g) -IF(APPLE) # mac os - ADD_DEFINITIONS(-std=c++0x) +if(NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 11) endif() +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +ADD_DEFINITIONS(-O3 -Wall -g) -ADD_SUBDIRECTORY(deps) ADD_SUBDIRECTORY(test) ENABLE_TESTING()