Use CXX_STANDARD 14 and centralize the setting to utils.cmake

This commit is contained in:
Tobias Hieta 2016-03-31 09:56:49 +02:00
parent fbb795dd46
commit 09e7605b68
6 changed files with 11 additions and 12 deletions

View File

@ -166,3 +166,8 @@ MACRO(ENABLE_IF_LINKS _variable _flag)
ENDIF()
ENDIF()
ENDMACRO()
#############################################################
function(std_target_properties target)
set_target_properties(${target} PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED ON)
endfunction()

View File

@ -7,4 +7,4 @@ add_definitions(-DQHTTP_EXPORT)
set(CMAKE_AUTOMOC ON)
add_library(qhttp STATIC ${HTTP_SRC} 3rdparty/http-parser/http_parser.c)
target_link_libraries(qhttp)
set_target_properties(qhttp PROPERTIES CXX_STANDARD 11)
std_target_properties(qhttp)

View File

@ -131,13 +131,11 @@ endif()
get_property(BUNDLED_FILES GLOBAL PROPERTY CONFIG_BUNDLED_FILES)
add_executable(${MAIN_TARGET} WIN32 MACOSX_BUNDLE ${SOURCES} ${BUNDLED_FILES} ${RESOURCE_FILES})
std_target_properties(${MAIN_TARGET})
set_target_properties(${MAIN_TARGET} PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/bundle/osx/Info.plist.in
INSTALL_RPATH "${QTROOT}/lib"
OUTPUT_NAME ${MAIN_NAME}
CXX_STANDARD 11
CXX_STANDARD_REQUIRED TRUE
)
clang_tidy(${MAIN_TARGET})

View File

@ -9,6 +9,6 @@ add_library(shared STATIC
${CMAKE_CURRENT_BINARY_DIR}/Names.cpp Names.h
)
set_target_properties(shared PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED TRUE)
std_target_properties(shared)
clang_tidy(shared)

View File

@ -13,9 +13,8 @@ add_executable(${HELPER_TARGET} WIN32
)
target_link_libraries(${HELPER_TARGET} ${Qt5Core_LIBRARIES} ${Qt5Network_LIBRARIES} qslog shared)
std_target_properties(${HELPER_TARGET})
set_target_properties(${HELPER_TARGET} PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED TRUE
OUTPUT_NAME ${HELPER_NAME}
)

View File

@ -4,8 +4,5 @@ add_executable(socket-client
SocketClient.cpp
$<TARGET_OBJECTS:shared>
)
set_target_properties(socket-client PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED TRUE
)
target_link_libraries(socket-client ${Qt5Network_LIBRARIES} ${Qt5Core_LIBRARIES} qslog)
std_target_properties(socket-client)
target_link_libraries(socket-client ${Qt5Network_LIBRARIES} ${Qt5Core_LIBRARIES} qslog)