From 6700956c631d3006932445d3af9a03cb841618b8 Mon Sep 17 00:00:00 2001 From: mutouyun Date: Tue, 1 Jan 2019 15:24:11 +0800 Subject: [PATCH] update CMakeLists.txt --- build/CMakeLists.txt | 6 ++++++ build/ipc/CMakeLists.txt | 7 ------- build/test/CMakeLists.txt | 13 +++++-------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index 4df2f3f..586c563 100644 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -1,3 +1,9 @@ cmake_minimum_required(VERSION 3.10) project(cpp-ipc) + +set(CMAKE_CXX_STANDARD 17) +if(NOT MSVC) + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2") +endif() + add_subdirectory(test) \ No newline at end of file diff --git a/build/ipc/CMakeLists.txt b/build/ipc/CMakeLists.txt index b01dfe8..52c88e9 100644 --- a/build/ipc/CMakeLists.txt +++ b/build/ipc/CMakeLists.txt @@ -1,13 +1,6 @@ -cmake_minimum_required(VERSION 3.10) project(ipc) add_compile_definitions(__IPC_LIBRARY__) -if(MSVC) - add_compile_options(/std:c++17) -else() - add_compile_options(-std=gnu++1z) - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2") -endif() include_directories(../../include ../../src) diff --git a/build/test/CMakeLists.txt b/build/test/CMakeLists.txt index 7bf9e8a..d14df61 100644 --- a/build/test/CMakeLists.txt +++ b/build/test/CMakeLists.txt @@ -1,15 +1,12 @@ -cmake_minimum_required(VERSION 3.10) project(test) set(CMAKE_AUTOMOC ON) -find_package(Qt5Core) -find_package(Qt5Test) +set(CMAKE_INCLUDE_CURRENT_DIR ON) -if(MSVC) - add_compile_options(/std:c++17) -else() - add_compile_options(-std=gnu++1z -Wno-unused-function -Wno-attributes) - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2") +find_package(Qt5 COMPONENTS Core Test REQUIRED) + +if(NOT MSVC) + add_compile_options(-Wno-unused-function -Wno-attributes) endif() include_directories(../../include ../../src ../../test ../../test/capo)