Skip to content

Commit

Permalink
fix: add include guard to all files
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Mar 21, 2022
1 parent 9362551 commit ecc4314
Show file tree
Hide file tree
Showing 21 changed files with 42 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Index.cmake
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
include_guard()

include("${CMAKE_CURRENT_LIST_DIR}/src/Index.cmake")
2 changes: 2 additions & 0 deletions src/Cache.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include_guard()

# Enable cache if available
function(enable_cache)
set(CACHE_OPTION
Expand Down
2 changes: 2 additions & 0 deletions src/Common.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include_guard()

# Common project settings run by default for all the projects that call `project_options()`
macro(common_project_options)
include("${ProjectOptions_SRC_DIR}/PreventInSourceBuilds.cmake")
Expand Down
2 changes: 2 additions & 0 deletions src/CompilerWarnings.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include_guard()

# Set the compiler warnings
#
# https://clang.llvm.org/docs/DiagnosticsReference.html
Expand Down
2 changes: 2 additions & 0 deletions src/Conan.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include_guard()

# Run Conan for dependency management
macro(run_conan)
# Download automatically, you can also just copy the conan.cmake file
Expand Down
2 changes: 2 additions & 0 deletions src/Cuda.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include_guard()

# ! target_link_cuda
# A function that links Cuda to the given target
#
Expand Down
2 changes: 2 additions & 0 deletions src/Doxygen.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include_guard()

# Enable doxygen doc builds of source
function(enable_doxygen DOXYGEN_THEME)
# If not specified, use the top readme file as the first page
Expand Down
2 changes: 2 additions & 0 deletions src/DynamicProjectOptions.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include_guard()

# ENABLE_DEVELOPER_MODE: sets defaults appropriate for developers, this is defaulted to ON
# * WARNINGS_AS_ERRORS: ON
# * ENABLE_SANITIZER_ADDRESS: ON
Expand Down
2 changes: 2 additions & 0 deletions src/Index.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
cmake_minimum_required(VERSION 3.16)

include_guard()

set(ProjectOptions_SRC_DIR
${CMAKE_CURRENT_LIST_DIR}
CACHE FILEPATH "")
Expand Down
2 changes: 2 additions & 0 deletions src/Linker.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include_guard()

# TODO use function arguments instead of CMake cache variables and options

# Set the linker to use for the linking phase
Expand Down
2 changes: 2 additions & 0 deletions src/Optimization.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include_guard()

macro(enable_interprocedural_optimization project_name)
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
include(CheckIPOSupported)
Expand Down
2 changes: 2 additions & 0 deletions src/PackageProject.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include_guard()

# Uses ycm (permissive BSD-3-Clause license) and ForwardArguments (permissive MIT license)

# A function that packages the project for external usage (e.g. from vcpkg, Conan, etc).
Expand Down
2 changes: 2 additions & 0 deletions src/PreventInSourceBuilds.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include_guard()

#
# This function will prevent in-source builds
#
Expand Down
2 changes: 2 additions & 0 deletions src/Sanitizers.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include_guard()

function(
enable_sanitizers
project_name
Expand Down
2 changes: 2 additions & 0 deletions src/Standards.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include_guard()

# Set the default copmiler standards if not specified
macro(set_standards)

Expand Down
2 changes: 2 additions & 0 deletions src/StaticAnalyzers.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include_guard()

# Enable static analysis with Cppcheck
macro(enable_cppcheck CPPCHECK_OPTIONS)
find_program(CPPCHECK cppcheck)
Expand Down
2 changes: 2 additions & 0 deletions src/SystemLink.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include_guard()

# Include a system directory (which suppresses its warnings).
function(target_include_system_directories target)
set(multiValueArgs INTERFACE PUBLIC PRIVATE)
Expand Down
2 changes: 2 additions & 0 deletions src/Tests.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include_guard()

# Enable coverage reporting for gcc/clang
function(enable_coverage project_name)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
Expand Down
2 changes: 2 additions & 0 deletions src/Utilities.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include_guard()

# find a subtring from a string by a given prefix such as VCVARSALL_ENV_START
function(
find_substring_by_prefix
Expand Down
2 changes: 2 additions & 0 deletions src/VCEnvironment.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include_guard()

include("${ProjectOptions_SRC_DIR}/Utilities.cmake")

# Run vcvarsall.bat and set CMake environment variables
Expand Down
2 changes: 2 additions & 0 deletions src/Vcpkg.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include_guard()

include(FetchContent)

# Install vcpkg and vcpkg dependencies: - should be called before defining project()
Expand Down

0 comments on commit ecc4314

Please sign in to comment.