Skip to content

Commit

Permalink
Merge #696(kitsune): CMakeLists: apply common properties to the entir…
Browse files Browse the repository at this point in the history
…e source tree
  • Loading branch information
KitsuneRal authored Aug 13, 2023
2 parents 2ae8d5d + d060974 commit 4cbe830
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
29 changes: 12 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ else()
add_compile_options(-fno-exceptions)
endif()

add_compile_definitions(
QT_NO_JAVA_STYLE_ITERATORS QT_NO_URL_CAST_FROM_STRING QT_NO_CAST_TO_ASCII
QT_NO_CAST_FROM_ASCII QT_STRICT_ITERATORS QT_NO_CAST_FROM_BYTEARRAY
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_FOREACH)

set_directory_properties(PROPERTIES
CXX_STANDARD 20
CXX_EXTENSIONS OFF
VISIBILITY_INLINES_HIDDEN ON
CXX_VISIBILITY_PRESET hidden
)

option(BUILD_WITH_QT6 "Build Quotient with Qt 6 (EXPERIMENTAL)" OFF)
if (BUILD_WITH_QT6)
set(QUOTIENT_LIB_NAME ${PROJECT_NAME}Qt6)
Expand Down Expand Up @@ -269,37 +281,20 @@ add_feature_info(EnableApiCodeGeneration "${API_GENERATION_ENABLED}"
file(GLOB_RECURSE api_ALL_SRCS CONFIGURE_DEPENDS
${FULL_CSAPI_DIR}/*.* Quotient/${ASAPI_DEF_DIR}/*.* Quotient/${ISAPI_DEF_DIR}/*.*)

add_compile_options(
-DQT_NO_CAST_TO_ASCII
-DQT_NO_CAST_FROM_ASCII
-DQT_NO_URL_CAST_FROM_STRING
-DQT_NO_CAST_FROM_BYTEARRAY
-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT
-DQT_NO_FOREACH
)

add_library(${QUOTIENT_LIB_NAME} ${lib_SRCS} ${api_ALL_SRCS})
# Set BUILDING_SHARED_QUOTIENT if building as a shared library
target_compile_definitions(${QUOTIENT_LIB_NAME} PRIVATE
$<$<STREQUAL:$<TARGET_PROPERTY:${QUOTIENT_LIB_NAME},TYPE>,SHARED_LIBRARY>:BUILDING_SHARED_QUOTIENT>)
# Set QUOTIENT_STATIC in a static library setting
target_compile_definitions(${QUOTIENT_LIB_NAME} PUBLIC
$<$<STREQUAL:$<TARGET_PROPERTY:${QUOTIENT_LIB_NAME},TYPE>,STATIC_LIBRARY>:QUOTIENT_STATIC>)
target_compile_definitions(${QUOTIENT_LIB_NAME} PRIVATE
QT_NO_JAVA_STYLE_ITERATORS QT_NO_URL_CAST_FROM_STRING QT_NO_CAST_TO_ASCII
QT_STRICT_ITERATORS QT_NO_CAST_FROM_BYTEARRAY)

target_compile_definitions(${QUOTIENT_LIB_NAME} PUBLIC ${PROJECT_NAME}_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}
${PROJECT_NAME}_VERSION_MINOR=${PROJECT_VERSION_MINOR} ${PROJECT_NAME}_VERSION_PATCH=${PROJECT_VERSION_PATCH}
${PROJECT_NAME}_VERSION_STRING=\"${PROJECT_VERSION}\")
if (${PROJECT_NAME}_ENABLE_E2EE)
target_compile_definitions(${QUOTIENT_LIB_NAME} PUBLIC ${PROJECT_NAME}_E2EE_ENABLED)
endif()
set_target_properties(${QUOTIENT_LIB_NAME} PROPERTIES
CXX_STANDARD 20
CXX_EXTENSIONS OFF
VISIBILITY_INLINES_HIDDEN ON
CXX_VISIBILITY_PRESET hidden
VERSION "${PROJECT_VERSION}"
SOVERSION ${API_VERSION}
INTERFACE_${PROJECT_NAME}_MAJOR_VERSION ${API_VERSION}
Expand Down
5 changes: 0 additions & 5 deletions quotest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ find_package(${Qt} COMPONENTS Concurrent)
add_executable(quotest ${quotest_SRCS})
target_link_libraries(quotest PRIVATE ${Qt}::Core ${Qt}::Test ${Qt}::Concurrent ${QUOTIENT_LIB_NAME})

set_target_properties(quotest PROPERTIES
VISIBILITY_INLINES_HIDDEN ON
CXX_VISIBILITY_PRESET hidden
)

if (MSVC)
target_compile_options(quotest PUBLIC /EHsc /W4
/wd4100 /wd4127 /wd4242 /wd4244 /wd4245 /wd4267 /wd4365 /wd4456 /wd4459
Expand Down

0 comments on commit 4cbe830

Please sign in to comment.