add cmake-format.py and formating all cmake files

This commit is contained in:
Stepanov Igor
2025-01-09 16:32:54 +03:00
parent 7bbd8bab34
commit bb15d17892
5 changed files with 105 additions and 69 deletions
+23 -12
View File
@@ -8,24 +8,35 @@ add_executable(${PROJECT_NAME} ${SOURCES})
if(MSVC)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
set(CMAKE_BUILD_TYPE
Release
CACHE STRING "Build type" FORCE)
endif()
if((CMAKE_BUILD_TYPE EQUAL "Release") OR (CMAKE_BUILD_TYPE EQUAL "RelWithDebInfo"))
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Release>:Release>")
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /MT /O2)
if((CMAKE_BUILD_TYPE EQUAL "Release") OR (CMAKE_BUILD_TYPE EQUAL
"RelWithDebInfo"))
set(CMAKE_MSVC_RUNTIME_LIBRARY
"MultiThreaded$<$<CONFIG:Release>:Release>")
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /MT /O2)
else()
target_compile_options(${PROJECT_NAME} PRIVATE /W4)
target_compile_options(${PROJECT_NAME} PRIVATE /W4)
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra
-Wformat-nonliteral -Wcast-align
-Wpointer-arith -Wundef
-Wwrite-strings -Wno-unused-parameter)
target_compile_options(
${PROJECT_NAME}
PRIVATE -Wall
-Wextra
-Wformat-nonliteral
-Wcast-align
-Wpointer-arith
-Wundef
-Wwrite-strings
-Wno-unused-parameter)
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -no-pie -lstdc++fs")
endif()
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../src ${CMAKE_DL_LIBS})
target_include_directories(
${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../src ${CMAKE_DL_LIBS})