Skip to content

Commit

Permalink
cmake refactoring.
Browse files Browse the repository at this point in the history
- cmake files refactored for different compiler and only enable warnings for debug build.

- switch c++17 to c++20 so recent Qt version support C++20.
  • Loading branch information
dsm committed Jul 26, 2024
1 parent c41931a commit b0a05ef
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 42 deletions.
27 changes: 20 additions & 7 deletions qucs-activefilter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,27 @@ else()
endif()


set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if (MSVC)
add_compile_options(/Zc:__cplusplus /permissive- /MP /Zc:preprocessor)
else()
# additional warnings
add_compile_options(-Wall -Wextra)
set(CMAKE_CXX_EXTENSIONS OFF)

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
add_compile_options(/Zc:__cplusplus /MP /Zc:preprocessor /Od)
else()
add_compile_options(-Wall -Wextra -O0 -g)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Wno-ignored-attributes)
endif()
endif()
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
add_compile_options(/Zc:__cplusplus /MP /Zc:preprocessor /Od /W0)
else()
add_compile_options(-w)
endif()
endif()

ADD_DEFINITIONS(${QT_DEFINITIONS})
Expand Down
29 changes: 21 additions & 8 deletions qucs-attenuator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,29 @@ include_directories(
${Qt${QT_VERSION_MAJOR}Widgets_INCLUDE_DIRS}
)


set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if (MSVC)
add_compile_options(/Zc:__cplusplus /permissive- /MP /Zc:preprocessor)
else()
# additional warnings
add_compile_options(-Wall -Wextra)
set(CMAKE_CXX_EXTENSIONS OFF)

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
add_compile_options(/Zc:__cplusplus /MP /Zc:preprocessor /Od)
else()
add_compile_options(-Wall -Wextra -O0 -g)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Wno-ignored-attributes)
endif()
endif()
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
add_compile_options(/Zc:__cplusplus /MP /Zc:preprocessor /Od /W0)
else()
add_compile_options(-w)
endif()
endif()

ADD_DEFINITIONS(${QT_DEFINITIONS})

#ADD_SUBDIRECTORY( bitmaps ) -> added as resources
Expand Down
27 changes: 20 additions & 7 deletions qucs-filter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,27 @@ include_directories(
)


set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if (MSVC)
add_compile_options(/Zc:__cplusplus /permissive- /MP /Zc:preprocessor)
else()
# additional warnings
add_compile_options(-Wall -Wextra)
set(CMAKE_CXX_EXTENSIONS OFF)

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
add_compile_options(/Zc:__cplusplus /MP /Zc:preprocessor /Od)
else()
add_compile_options(-Wall -Wextra -O0 -g)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Wno-ignored-attributes)
endif()
endif()
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
add_compile_options(/Zc:__cplusplus /MP /Zc:preprocessor /Od /W0)
else()
add_compile_options(-w)
endif()
endif()

ADD_DEFINITIONS(${QT_DEFINITIONS})
Expand Down
28 changes: 20 additions & 8 deletions qucs-powercombining/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,27 @@ else()
)
endif()


set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if (MSVC)
add_compile_options(/Zc:__cplusplus /permissive- /MP /Zc:preprocessor)
else()
# additional warnings
add_compile_options(-Wall -Wextra)
set(CMAKE_CXX_EXTENSIONS OFF)

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
add_compile_options(/Zc:__cplusplus /MP /Zc:preprocessor /Od)
else()
add_compile_options(-Wall -Wextra -O0 -g)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Wno-ignored-attributes)
endif()
endif()
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
add_compile_options(/Zc:__cplusplus /MP /Zc:preprocessor /Od /W0)
else()
add_compile_options(-w)
endif()
endif()

ADD_DEFINITIONS(${QT_DEFINITIONS})
Expand Down
23 changes: 18 additions & 5 deletions qucs-transcalc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,27 @@ include_directories(
)


set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if (MSVC)
add_compile_options(/Zc:__cplusplus /permissive- /MP /Zc:preprocessor)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
add_compile_options(/Zc:__cplusplus /MP /Zc:preprocessor /Od)
else()
# additional warnings
add_compile_options(-Wall -Wextra)
add_compile_options(-Wall -Wextra -O0 -g)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Wno-ignored-attributes)
endif()
endif()
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
add_compile_options(/Zc:__cplusplus /MP /Zc:preprocessor /Od /W0)
else()
add_compile_options(-w)
endif()
endif()

ADD_DEFINITIONS(${QT_DEFINITIONS})
Expand Down
28 changes: 21 additions & 7 deletions qucs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,28 @@ set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
ENDIF()
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if (MSVC)
add_compile_options(/Zc:__cplusplus /permissive- /MP /Zc:preprocessor)
else()
# additional warnings
add_compile_options(-Wall -Wextra)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
add_compile_options(/Zc:__cplusplus /MP /Zc:preprocessor /Od)
else()
add_compile_options(-Wall -Wextra -O0 -g)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Wno-ignored-attributes)
endif()
endif()
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
add_compile_options(/Zc:__cplusplus /MP /Zc:preprocessor /Od /W0)
else()
add_compile_options(-w)
endif()
endif()

INCLUDE_DIRECTORIES(
Expand Down

0 comments on commit b0a05ef

Please sign in to comment.