Skip to content

Commit 733e100

Browse files
committed
CMake modernization/cleanup
1 parent c614893 commit 733e100

File tree

21 files changed

+34
-33
lines changed

21 files changed

+34
-33
lines changed

CMakeLists.txt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4-
cmake_minimum_required(VERSION 3.8.2)
4+
cmake_minimum_required(VERSION 3.15)
55

6-
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.15")
7-
# Enable CMAKE_MSVC_RUNTIME_LIBRARY on Windows.
8-
set(MSVC_MATCH_VCPKG_TRIPLET ON)
9-
cmake_policy(SET CMP0091 NEW)
10-
endif()
6+
# Enable CMAKE_MSVC_RUNTIME_LIBRARY on Windows: https://cmake.org/cmake/help/latest/policy/CMP0091.html
7+
cmake_policy(SET CMP0091 NEW)
118

129
# Default to the last updated version from version.txt.
1310
file(TO_CMAKE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/version.txt" VERSION_FILE)
@@ -43,7 +40,7 @@ option(BUILD_SHARED_LIBS "Build shared libraries instead of static libs" OFF)
4340
if(VCPKG_TARGET_TRIPLET)
4441
message(STATUS "Using ${VCPKG_TARGET_TRIPLET} triplet with vcpkg")
4542

46-
if(MSVC AND MSVC_MATCH_VCPKG_TRIPLET)
43+
if(MSVC)
4744
# Match the MSVC runtime if we're using VCPKG with static libraries.
4845
if(VCPKG_TARGET_TRIPLET MATCHES [[^.+-static$]])
4946
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")

cmake/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4-
cmake_minimum_required(VERSION 3.8.2)
4+
cmake_minimum_required(VERSION 3.15)
55

66
# Enable version checks in find_package
77
include(CMakePackageConfigHelpers)

cmake/cppgraphqlgen-update-client-files.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ if(NOT FILE_NAMES)
4141
message(FATAL_ERROR "Schema generation failed!")
4242
endif()
4343

44-
# Remove stale files in the source directory
44+
# Support if() IN_LIST operator: https://cmake.org/cmake/help/latest/policy/CMP0057.html
4545
cmake_policy(SET CMP0057 NEW)
46+
47+
# Remove stale files in the source directory
4648
file(GLOB OLD_FILES ${CLIENT_SOURCE_DIR}/*.h ${CLIENT_SOURCE_DIR}/*.cpp)
4749
foreach(OLD_FILE ${OLD_FILES})
4850
get_filename_component(OLD_FILE ${OLD_FILE} NAME)

cmake/cppgraphqlgen-update-schema-files.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ if(NOT FILE_NAMES)
4040
message(FATAL_ERROR "Schema generation failed!")
4141
endif()
4242

43-
# Remove stale files in the source directory
43+
# Support if() IN_LIST operator: https://cmake.org/cmake/help/latest/policy/CMP0057.html
4444
cmake_policy(SET CMP0057 NEW)
45+
46+
# Remove stale files in the source directory
4547
file(GLOB OLD_FILES ${SCHEMA_SOURCE_DIR}/*.h ${SCHEMA_SOURCE_DIR}/*.cpp)
4648
foreach(OLD_FILE ${OLD_FILES})
4749
get_filename_component(OLD_FILE ${OLD_FILE} NAME)

samples/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4-
cmake_minimum_required(VERSION 3.8.2)
4+
cmake_minimum_required(VERSION 3.15)
55

66
add_subdirectory(client)
77
add_subdirectory(learn)

samples/client/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4-
cmake_minimum_required(VERSION 3.8.2)
4+
cmake_minimum_required(VERSION 3.15)
55

66
add_subdirectory(query)
77
add_subdirectory(mutate)

samples/client/benchmark/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4-
cmake_minimum_required(VERSION 3.8.2)
4+
cmake_minimum_required(VERSION 3.15)
55

66
# Normally this would be handled by find_package(cppgraphqlgen CONFIG).
77
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/cppgraphqlgen-functions.cmake)

samples/client/mutate/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4-
cmake_minimum_required(VERSION 3.8.2)
4+
cmake_minimum_required(VERSION 3.15)
55

66
# Normally this would be handled by find_package(cppgraphqlgen CONFIG).
77
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/cppgraphqlgen-functions.cmake)

samples/client/query/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4-
cmake_minimum_required(VERSION 3.8.2)
4+
cmake_minimum_required(VERSION 3.15)
55

66
# Normally this would be handled by find_package(cppgraphqlgen CONFIG).
77
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/cppgraphqlgen-functions.cmake)

samples/client/subscribe/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4-
cmake_minimum_required(VERSION 3.8.2)
4+
cmake_minimum_required(VERSION 3.15)
55

66
# Normally this would be handled by find_package(cppgraphqlgen CONFIG).
77
include(${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/cppgraphqlgen-functions.cmake)

0 commit comments

Comments
 (0)