Skip to content

Commit 9baee02

Browse files
authored
Update cmake to reflect new hotpatch and properly format script (#38)
2 parents 5a0ceb8 + c74798c commit 9baee02

File tree

1 file changed

+62
-62
lines changed

1 file changed

+62
-62
lines changed

CMakeLists.txt

+62-62
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
cmake_minimum_required(VERSION 3.18)
22

3-
set(CCMATH_BUILD_VERSION 0.1.3)
3+
set(CCMATH_BUILD_VERSION 0.1.4)
44

55
project(ccmath VERSION ${CCMATH_BUILD_VERSION})
66

77
set(is_root_project OFF) # Identifies if this is the root project
8-
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
9-
set(is_root_project ON)
10-
endif()
8+
if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
9+
set(is_root_project ON)
10+
endif ()
1111

1212
set(CMAKE_CXX_STANDARD 17)
1313
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -27,24 +27,24 @@ include(cmake/GlobalConfig.cmake)
2727
add_library(${PROJECT_NAME}-compile-options INTERFACE)
2828
add_library(${PROJECT_NAME}::${PROJECT_NAME}-compile-options ALIAS ${PROJECT_NAME}-compile-options)
2929

30-
if(CMAKE_CXX_COMPILER_ID STREQUAL Clang OR CMAKE_CXX_COMPILER_ID STREQUAL GNU)
31-
target_compile_options(${PROJECT_NAME}-compile-options INTERFACE
32-
-Wall -Wextra -Wpedantic -Wconversion -Werror=return-type
33-
)
34-
35-
# TODO: Remove this later.
36-
# Some variables have been provided but are not currently being used, but it would not atm make sense to remove them.
37-
# So to clean up the warnings we are just silencing these specific cases.
38-
target_compile_options(${PROJECT_NAME}-compile-options INTERFACE
39-
-Wno-unused-but-set-variable -Wno-unused-value
40-
)
41-
endif()
42-
43-
if(CMAKE_CXX_COMPILER_ID STREQUAL MSVC)
44-
target_compile_options(${PROJECT_NAME}-compile-options INTERFACE
45-
/W4 /Wall /WX /permissive- /Zc:__cplusplus
46-
)
47-
endif()
30+
if (CMAKE_CXX_COMPILER_ID STREQUAL Clang OR CMAKE_CXX_COMPILER_ID STREQUAL GNU)
31+
target_compile_options(${PROJECT_NAME}-compile-options INTERFACE
32+
-Wall -Wextra -Wpedantic -Wconversion -Werror=return-type
33+
)
34+
35+
# TODO: Remove this later.
36+
# Some variables have been provided but are not currently being used, but it would not atm make sense to remove them.
37+
# So to clean up the warnings we are just silencing these specific cases.
38+
target_compile_options(${PROJECT_NAME}-compile-options INTERFACE
39+
-Wno-unused-but-set-variable -Wno-unused-value
40+
)
41+
endif ()
42+
43+
if (CMAKE_CXX_COMPILER_ID STREQUAL MSVC)
44+
target_compile_options(${PROJECT_NAME}-compile-options INTERFACE
45+
/W4 /Wall /WX /permissive- /Zc:__cplusplus
46+
)
47+
endif ()
4848

4949
include(ccmath_headers.cmake)
5050

@@ -54,9 +54,9 @@ add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
5454
target_sources(${PROJECT_NAME} INTERFACE "$<BUILD_INTERFACE:${ccmath_headers}>")
5555

5656
if (CCMATH_ENABLE_EXTENSIONS)
57-
include(ccmath_extensions_headers.cmake)
58-
target_sources(${PROJECT_NAME} INTERFACE "$<BUILD_INTERFACE:${ccmath_extensions_headers}>")
59-
endif()
57+
include(ccmath_extensions_headers.cmake)
58+
target_sources(${PROJECT_NAME} INTERFACE "$<BUILD_INTERFACE:${ccmath_extensions_headers}>")
59+
endif ()
6060

6161
target_include_directories(${PROJECT_NAME} INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>)
6262
target_include_directories(${PROJECT_NAME} SYSTEM INTERFACE $<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>)
@@ -71,63 +71,63 @@ target_link_libraries(${PROJECT_NAME} INTERFACE
7171
configure_file(cmake/version.hpp.in "${CMAKE_CURRENT_BINARY_DIR}/include/${PROJECT_NAME}/version.hpp" @ONLY)
7272

7373
if (CCMATH_BUILD_EXAMPLES OR CCMATH_BUILD_BENCHMARKS OR CCMATH_BUILD_TESTS)
74-
add_subdirectory(thirdparty)
75-
endif()
74+
add_subdirectory(thirdparty)
75+
endif ()
7676

7777
if (CCMATH_BUILD_EXAMPLES)
78-
add_subdirectory(example)
79-
endif()
78+
add_subdirectory(example)
79+
endif ()
8080

8181
if (CCMATH_BUILD_BENCHMARKS)
82-
add_subdirectory(benchmark)
83-
endif()
82+
add_subdirectory(benchmark)
83+
endif ()
8484

8585
if (CCMATH_BUILD_TESTS)
86-
enable_testing()
87-
add_subdirectory(test)
88-
endif()
86+
enable_testing()
87+
add_subdirectory(test)
88+
endif ()
8989

9090
if (CCMATH_USE_SIMD)
91-
# TODO: Add a better way to handle enabling simd internally.
92-
add_compile_definitions(INTERNAL_CCMATH_ENABLE_CHECK_FOR_SIMD)
91+
# TODO: Add a better way to handle enabling simd internally.
92+
add_compile_definitions(INTERNAL_CCMATH_ENABLE_CHECK_FOR_SIMD)
9393
endif ()
9494

9595

96-
if(CCMATH_INSTALL)
97-
include(GNUInstallDirs)
98-
include(CMakePackageConfigHelpers)
96+
if (CCMATH_INSTALL)
97+
include(GNUInstallDirs)
98+
include(CMakePackageConfigHelpers)
9999

100-
install(TARGETS
101-
${PROJECT_NAME}
102-
${PROJECT_NAME}-compile-options
103-
EXPORT ${PROJECT_NAME}-targets
104-
)
100+
install(TARGETS
101+
${PROJECT_NAME}
102+
${PROJECT_NAME}-compile-options
103+
EXPORT ${PROJECT_NAME}-targets
104+
)
105105

106-
install(DIRECTORY
107-
"${CMAKE_CURRENT_SOURCE_DIR}/include/"
108-
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
109-
FILES_MATCHING PATTERN "*.hpp"
110-
)
106+
install(DIRECTORY
107+
"${CMAKE_CURRENT_SOURCE_DIR}/include/"
108+
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
109+
FILES_MATCHING PATTERN "*.hpp"
110+
)
111111

112-
install(FILES
112+
install(FILES
113113
"${CMAKE_CURRENT_BINARY_DIR}/include/${PROJECT_NAME}/version.hpp"
114114
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}"
115-
)
115+
)
116116

117-
install(EXPORT ${PROJECT_NAME}-targets
118-
FILE ${PROJECT_NAME}-targets.cmake
119-
NAMESPACE ${PROJECT_NAME}::
120-
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
121-
)
117+
install(EXPORT ${PROJECT_NAME}-targets
118+
FILE ${PROJECT_NAME}-targets.cmake
119+
NAMESPACE ${PROJECT_NAME}::
120+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
121+
)
122122

123-
configure_package_config_file(
123+
configure_package_config_file(
124124
cmake/${PROJECT_NAME}-config.cmake.in
125125
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
126126
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
127-
)
127+
)
128128

129-
install(FILES
130-
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
131-
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
129+
install(FILES
130+
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
131+
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
132132

133-
endif()
133+
endif ()

0 commit comments

Comments
 (0)