qucs_s/qucs-powercombining/CMakeLists.txt

130 lines
4.0 KiB
CMake
Raw Permalink Normal View History

PROJECT(qucspowercombining CXX C)
CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
cmake_policy(VERSION 3.10)
SET(QUCS_NAME "qucs-s")
# use top VERSION file
file (STRINGS ${PROJECT_SOURCE_DIR}/../VERSION QUCS_VERSION)
if(DEFINED CI_VERSION)
set(PROJECT_VERSION "${CI_VERSION}")
else()
set(PROJECT_VERSION "${QUCS_VERSION}")
endif()
message(STATUS "Configuring ${PROJECT_NAME} (GUI): VERSION ${PROJECT_VERSION}")
set(PROJECT_VENDOR "Qucs team. This program is licensed under the GNU GPL")
set(PROJECT_COPYRIGHT_YEAR "2016")
set(PROJECT_DOMAIN_FIRST "qucs")
set(PROJECT_DOMAIN_SECOND "org")
#SET(CMAKE_BUILD_TYPE Debug)
2023-02-13 13:25:30 +03:00
add_compile_definitions(HAVE_CONFIG_H)
2023-02-13 15:28:36 +03:00
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
# configure the header config.h
CONFIGURE_FILE (
"${PROJECT_SOURCE_DIR}/../config.h.cmake"
"${PROJECT_BINARY_DIR}/config.h"
)
INCLUDE_DIRECTORIES("${PROJECT_BINARY_DIR}")
find_package(Qt6 REQUIRED COMPONENTS Core Widgets Svg SvgWidgets)
include_directories(
${Qt6Core_INCLUDE_DIRS}
${Qt6Widgets_INCLUDE_DIRS}
${Qt6Svg_INCLUDE_DIRS}
${Qt6SvgWidgets_INCLUDE_DIRS}
)
set(QT_VERSION ${Qt6Core_VERSION})
if (${QT_VERSION} VERSION_LESS "6.7.0")
set(CMAKE_CXX_STANDARD 17)
else()
set(CMAKE_CXX_STANDARD 20)
endif()
2023-02-13 13:25:30 +03:00
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
2024-07-29 11:02:30 +03:00
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS)
add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /Od /vmg)
add_compile_options(/wd4244 /wd4267 /wd4312)
else()
add_compile_options(-Wall -Wextra -O0 -g)
if (CMAKE_CXX_COMPILER_ID MATCHES "^AppleClang$|^Clang$")
add_compile_options(-Wno-ignored-attributes)
endif()
endif()
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
2024-07-29 11:02:30 +03:00
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS _SCL_SECURE_NO_WARNINGS)
2024-11-24 14:14:54 +03:00
string(REGEX REPLACE "/W1" "/w" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
2024-07-29 11:02:30 +03:00
add_compile_options(/permissive- /Zc:__cplusplus /Zc:preprocessor /MP /vmg)
2024-11-24 14:14:54 +03:00
add_link_options(/OPT:REF /OPT:ICF)
2024-07-29 11:02:30 +03:00
else()
add_compile_options(-w)
endif()
2023-02-13 13:25:30 +03:00
endif()
ADD_DEFINITIONS(${QT_DEFINITIONS})
SET(QUCS-POWCOMB_SRCS
qucspowercombiningtool.cpp
main.cpp
)
SET(QUCS-POWCOMB_HDRS
qucspowercombiningtool.h
)
SET(QUCS-POWCOMB_MOC_HDRS
qucspowercombiningtool.h
)
SET(RESOURCES qucspowercombining.qrc)
QT6_WRAP_CPP(QUCS-POWCOMB_MOC_SRCS ${QUCS-POWCOMB_MOC_HDRS})
QT6_ADD_RESOURCES(RESOURCES_SRCS ${RESOURCES})
IF(APPLE)
# set information on Info.plist file
SET(MACOSX_BUNDLE_INFO_STRING "${PROJECT_NAME} ${PROJECT_VERSION}")
SET(MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_NAME} ${PROJECT_VERSION}")
SET(MACOSX_BUNDLE_LONG_VERSION_STRING "${PROJECT_NAME} ${PROJECT_VERSION}")
SET(MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}")
SET(MACOSX_BUNDLE_COPYRIGHT "${PROJECT_COPYRIGHT_YEAR} ${PROJECT_VENDOR}")
SET(MACOSX_BUNDLE_GUI_IDENTIFIER "${PROJECT_DOMAIN_SECOND}.${PROJECT_DOMAIN_FIRST}")
SET(MACOSX_BUNDLE_BUNDLE_NAME "${PROJECT_NAME}")
SET(MACOSX_BUNDLE_ICON_FILE qucspowercombining.icns)
# set where in the bundle to put the icns file
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/../qucs/bitmaps/qucspowercombining.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
# include the icns file in the target
SET(QUCS-POWCOMB_SRCS ${QUCS-POWCOMB_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/../qucs/bitmaps/qucspowercombining.icns)
ENDIF(APPLE)
ADD_EXECUTABLE(${QUCS_NAME}powercombining MACOSX_BUNDLE WIN32
${QUCS-POWCOMB_SRCS}
${QUCS-POWCOMB_HDRS}
${QUCS-POWCOMB_MOC_SRCS}
${RESOURCES_SRCS} )
TARGET_LINK_LIBRARIES(${QUCS_NAME}powercombining Qt6::Core
Qt6::Widgets Qt6::Svg Qt6::SvgWidgets)
SET_TARGET_PROPERTIES(${QUCS_NAME}powercombining PROPERTIES POSITION_INDEPENDENT_CODE TRUE)
INSTALL(TARGETS ${QUCS_NAME}powercombining
BUNDLE DESTINATION bin COMPONENT Runtime
RUNTIME DESTINATION bin COMPONENT Runtime
)