BLT/cmake/warnings.cmake

35 lines
1.9 KiB
CMake
Raw Normal View History

2024-04-25 19:35:05 -04:00
if(NOT WIN32)
string(ASCII 27 Esc)
set(ColourReset "${Esc}[m")
set(Blue "${Esc}[34m")
set(Green "${Esc}[32m")
endif ()
message("Enabling platform specific compile options for ${Blue}${PROJECT_NAME}${ColourReset}")
2024-02-24 03:30:31 -05:00
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# using Clang
2024-04-25 19:35:05 -04:00
message(STATUS "Clang Compile: ${Green}-Wall -Wextra -Wpedantic -Weverything -fdiagnostics-color=always${ColourReset}")
message(STATUS "Clang Link: ${Green}-export_dynamic${ColourReset}")
message(STATUS "Clang libs: ${Green}stdc++fs${ColourReset}")
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -fdiagnostics-color=always)
target_link_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -fdiagnostics-color=always)
target_link_options(${PROJECT_NAME} PUBLIC -export_dynamic -rdynamic)
2024-02-24 03:30:31 -05:00
target_link_libraries(${PROJECT_NAME} PUBLIC stdc++fs)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# using GCC
2024-04-25 19:35:05 -04:00
message(STATUS "GCC Compile: ${Green}-Wall -Wextra -Wpedantic -fdiagnostics-color=always${ColourReset}")
message(STATUS "GCC Link: ${Green}-rdynamic${ColourReset}")
message(STATUS "GCC libs: ${Green}stdc++fs${ColourReset}")
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -fdiagnostics-color=always)
target_link_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic -fdiagnostics-color=always)
2024-02-24 03:30:31 -05:00
target_link_options(${PROJECT_NAME} PUBLIC -rdynamic)
target_link_libraries(${PROJECT_NAME} PUBLIC stdc++fs)
include(GNUInstallDirs)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
# using Intel C++
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# using Visual Studio C++
2024-04-25 19:35:05 -04:00
message(STATUS "MSVC Compile: ${Green}/Wall${ColourReset}")
message(STATUS "MSVC Link: ${Green}${ColourReset}")
message(STATUS "MSVC libs: ${Green}${ColourReset}")
2024-02-24 03:30:31 -05:00
target_compile_options(${PROJECT_NAME} PUBLIC /Wall)
endif ()