Skip to content

Commit

Permalink
Remove some cmake warnings #268
Browse files Browse the repository at this point in the history
1. Update the cmake_minimum_required to 3.6.
2. Use COMMON_LANGUAGE_RUNTIME to set "/clr".
  • Loading branch information
gwankyun authored Aug 30, 2023
1 parent e21baec commit 0d9baad
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
cmake_minimum_required(VERSION 3.0)
if(${CMAKE_VERSION} VERSION_LESS 3.27.0)
cmake_minimum_required(VERSION 3.0)
else()
cmake_minimum_required(VERSION 3.6)
endif()

project(plog VERSION 1.1.10 LANGUAGES CXX)

Expand Down
6 changes: 5 additions & 1 deletion samples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
cmake_minimum_required(VERSION 3.0)
if(${CMAKE_VERSION} VERSION_LESS 3.27.0)
cmake_minimum_required(VERSION 3.0)
else()
cmake_minimum_required(VERSION 3.6)
endif()

if(POLICY CMP0063) #Honor visibility properties for all target types
cmake_policy(SET CMP0063 NEW)
Expand Down
6 changes: 5 additions & 1 deletion samples/CXX11/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
if (NOT CMAKE_VERSION VERSION_LESS 3.3.0)
cmake_minimum_required(VERSION 3.3)
if(${CMAKE_VERSION} VERSION_LESS 3.27.0)
cmake_minimum_required(VERSION 3.3)
else()
cmake_minimum_required(VERSION 3.6)
endif()

if(cxx_std_11 IN_LIST CMAKE_CXX_COMPILE_FEATURES)
add_executable(CXX11 Main.cpp)
Expand Down
6 changes: 5 additions & 1 deletion samples/CXX17/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
if (NOT CMAKE_VERSION VERSION_LESS 3.3.0)
cmake_minimum_required(VERSION 3.3)
if(${CMAKE_VERSION} VERSION_LESS 3.27.0)
cmake_minimum_required(VERSION 3.3)
else()
cmake_minimum_required(VERSION 3.6)
endif()

# Unfortunately cxx_std_17 in CMAKE_CXX_COMPILE_FEATURES is not reliable, so check include files
include(CheckIncludeFileCXX)
Expand Down
3 changes: 2 additions & 1 deletion samples/Demo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ set_target_properties(Demo PROPERTIES FOLDER Samples)
if(MSVC AND NOT (MSVC_VERSION LESS 1700)) # Visual Studio 2012 and higher
add_executable(DemoManaged Main.cpp MyClass.h MyClass.cpp Customer.h)
target_link_libraries(DemoManaged plog)
set_property(TARGET DemoManaged PROPERTY COMPILE_FLAGS "/clr /EHa")
set_property(TARGET DemoManaged PROPERTY COMPILE_FLAGS "/EHa")
set_property(TARGET DemoManaged PROPERTY COMMON_LANGUAGE_RUNTIME "")
set_target_properties(DemoManaged PROPERTIES FOLDER Samples CXX_STANDARD 17 CXX_STANDARD_REQUIRED OFF) # the latest standard supported by CLR is C++17
endif()

Expand Down

0 comments on commit 0d9baad

Please sign in to comment.