Skip to content

Commit bea3226

Browse files
authored
Merge branch 'main' into static_analysis_updates
2 parents af382c4 + 64a1627 commit bea3226

3 files changed

Lines changed: 28 additions & 25 deletions

File tree

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ cmake_minimum_required(VERSION 3.16)
1515
# You can later set fine-grained standards for each target using `target_compile_features`
1616
# set(CMAKE_CXX_STANDARD 17)
1717
18-
# Add project_options v0.13.0
18+
# Add project_options v0.13.1
1919
# https://github.com/cpp-best-practices/project_options
2020
include(FetchContent)
21-
FetchContent_Declare(_project_options URL https://github.com/cpp-best-practices/project_options/archive/refs/tags/v0.13.0.zip)
21+
FetchContent_Declare(_project_options URL https://github.com/cpp-best-practices/project_options/archive/refs/tags/v0.13.1.zip)
2222
FetchContent_MakeAvailable(_project_options)
2323
include(${_project_options_SOURCE_DIR}/Index.cmake)
2424
@@ -154,10 +154,10 @@ cmake_minimum_required(VERSION 3.16)
154154
# You can later set fine-grained standards for each target using `target_compile_features`
155155
# set(CMAKE_CXX_STANDARD 17)
156156
157-
# Add project_options v0.13.0
157+
# Add project_options v0.13.1
158158
# https://github.com/cpp-best-practices/project_options
159159
include(FetchContent)
160-
FetchContent_Declare(_project_options URL https://github.com/cpp-best-practices/project_options/archive/refs/tags/v0.13.0.zip)
160+
FetchContent_Declare(_project_options URL https://github.com/cpp-best-practices/project_options/archive/refs/tags/v0.13.1.zip)
161161
FetchContent_MakeAvailable(_project_options)
162162
include(${_project_options_SOURCE_DIR}/Index.cmake)
163163

src/CompilerWarnings.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function(
99
MSVC_WARNINGS
1010
CLANG_WARNINGS
1111
GCC_WARNINGS)
12-
if(MSVC_WARNINGS STREQUAL "")
12+
if("${MSVC_WARNINGS}" STREQUAL "")
1313
set(MSVC_WARNINGS
1414
/W4 # Baseline reasonable warnings
1515
/w14242 # 'identifier': conversion from 'type1' to 'type1', possible loss of data
@@ -37,7 +37,7 @@ if(MSVC_WARNINGS STREQUAL "")
3737
)
3838
endif()
3939

40-
if(CLANG_WARNINGS STREQUAL "")
40+
if("${CLANG_WARNINGS}" STREQUAL "")
4141
set(CLANG_WARNINGS
4242
-Wall
4343
-Wextra # reasonable and standard
@@ -58,7 +58,7 @@ if(MSVC_WARNINGS STREQUAL "")
5858
)
5959
endif()
6060

61-
if(GCC_WARNINGS STREQUAL "")
61+
if("${GCC_WARNINGS}" STREQUAL "")
6262
set(GCC_WARNINGS
6363
${CLANG_WARNINGS}
6464
-Wmisleading-indentation # warn if indentation implies blocks where blocks do not exist

src/Vcpkg.cmake

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,50 @@ macro(run_vcpkg)
66
# optional named VCPKG_DIR and VCPKG_URL argument
77
set(oneValueArgs VCPKG_DIR VCPKG_URL)
88
cmake_parse_arguments(
9-
project_options
10-
""
9+
_vcpkg_args
10+
"${options}"
1111
"${oneValueArgs}"
1212
""
1313
${ARGN})
1414

15-
if(${ProjectOptions_VCPKG_DIR})
15+
if(NOT "${_vcpkg_args_VCPKG_DIR}" STREQUAL "")
1616
# the installation directory is specified
17-
get_filename_component(VCPKG_PARENT_DIR ${ProjectOptions_VCPKG_DIR} DIRECTORY)
17+
get_filename_component(VCPKG_PARENT_DIR ${_vcpkg_args_VCPKG_DIR} DIRECTORY)
1818
else()
1919
# Default vcpkg installation directory
2020
if(WIN32)
2121
set(VCPKG_PARENT_DIR $ENV{userprofile})
22-
set(ProjectOptions_VCPKG_DIR ${VCPKG_PARENT_DIR}/vcpkg)
22+
set(_vcpkg_args_VCPKG_DIR ${VCPKG_PARENT_DIR}/vcpkg)
2323
else()
2424
set(VCPKG_PARENT_DIR $ENV{HOME})
25-
set(ProjectOptions_VCPKG_DIR ${VCPKG_PARENT_DIR}/vcpkg)
25+
set(_vcpkg_args_VCPKG_DIR ${VCPKG_PARENT_DIR}/vcpkg)
2626
endif()
2727
endif()
2828

29-
# check if the vcpkg is installed
30-
if(EXISTS ${ProjectOptions_VCPKG_DIR})
31-
message(STATUS "${ProjectOptions_VCPKG_DIR} already exists.")
32-
if(${ProjectOptions_ENABLE_VCPKG_UPDATE})
29+
# check if vcpkg is installed
30+
if (WIN32 AND "${CMAKE_EXECUTABLE_SUFFIX}" STREQUAL "")
31+
set(CMAKE_EXECUTABLE_SUFFIX ".exe")
32+
endif()
33+
if(EXISTS "${_vcpkg_args_VCPKG_DIR}" AND EXISTS "${_vcpkg_args_VCPKG_DIR}/vcpkg${CMAKE_EXECUTABLE_SUFFIX}")
34+
message(STATUS "vcpkg is already installed at ${_vcpkg_args_VCPKG_DIR}.")
35+
if(${_vcpkg_args_ENABLE_VCPKG_UPDATE})
3336
message(STATUS "Updating the repository...")
34-
execute_process(COMMAND "git" "pull" WORKING_DIRECTORY ${ProjectOptions_VCPKG_DIR})
37+
execute_process(COMMAND "git" "pull" WORKING_DIRECTORY ${_vcpkg_args_VCPKG_DIR})
3538
endif()
3639
else()
37-
message(STATUS "Installing vcpkg at ${ProjectOptions_VCPKG_DIR}")
40+
message(STATUS "Installing vcpkg at ${_vcpkg_args_VCPKG_DIR}")
3841
# clone vcpkg from Github
39-
if(NOT ${ProjectOptions_VCPKG_URL})
40-
set(ProjectOptions_VCPKG_URL "https://github.com/microsoft/vcpkg.git")
42+
if("${_vcpkg_args_VCPKG_URL}" STREQUAL "")
43+
set(_vcpkg_args_VCPKG_URL "https://github.com/microsoft/vcpkg.git")
4144
endif()
42-
execute_process(COMMAND "git" "clone" "${ProjectOptions_VCPKG_URL}" WORKING_DIRECTORY ${VCPKG_PARENT_DIR})
45+
execute_process(COMMAND "git" "clone" "${_vcpkg_args_VCPKG_URL}" WORKING_DIRECTORY ${VCPKG_PARENT_DIR})
4346
# Run vcpkg bootstrap
44-
execute_process(COMMAND "./vcpkg/bootstrap-vcpkg" WORKING_DIRECTORY "${ProjectOptions_VCPKG_DIR}")
47+
execute_process(COMMAND "./vcpkg/bootstrap-vcpkg" WORKING_DIRECTORY "${_vcpkg_args_VCPKG_DIR}")
4548
endif()
4649

4750
# Setting up vcpkg toolchain
4851
list(APPEND VCPKG_FEATURE_FLAGS "versions")
4952
set(CMAKE_TOOLCHAIN_FILE
50-
${ProjectOptions_VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake
51-
CACHE STRING "Vcpkg toolchain file")
53+
${_vcpkg_args_VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake
54+
CACHE STRING "vcpkg toolchain file")
5255
endmacro()

0 commit comments

Comments
 (0)