diff options
author | Albert Astals Cid <albert.astals.cid@kdab.com> | 2019-02-19 17:37:30 +0100 |
---|---|---|
committer | Albert Astals Cid <albert.astals.cid@kdab.com> | 2019-02-21 13:51:19 +0000 |
commit | a25f9a15076782154bf7cf58e3c5af29a7b6653e (patch) | |
tree | 36e3abdc4bcfa9de59c33d97e66ab56e5455dcd1 | |
parent | 632d014afd5a3c1a40fc67cf0fc78d8c80d3da8f (diff) |
cmake: Start adding compiler flags
Only has warnings for now
Next to come is the support for developer-build and enabling Werror
Change-Id: I8070dc06eb439c2a03007cce975c8147ff7e1582
Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
-rw-r--r-- | cmake/QtBaseGlobalTargets.cmake | 1 | ||||
-rw-r--r-- | cmake/QtCompilerFlags.cmake | 6 | ||||
-rw-r--r-- | cmake/QtSetup.cmake | 3 |
3 files changed, 10 insertions, 0 deletions
diff --git a/cmake/QtBaseGlobalTargets.cmake b/cmake/QtBaseGlobalTargets.cmake index 6074f1233c..73deb51b49 100644 --- a/cmake/QtBaseGlobalTargets.cmake +++ b/cmake/QtBaseGlobalTargets.cmake @@ -64,6 +64,7 @@ install(EXPORT "${INSTALL_CMAKE_NAMESPACE}Targets" NAMESPACE ${INSTALL_CMAKE_EXP ## Install some QtBase specific CMake files: install(FILES cmake/QtBuild.cmake + cmake/QtCompilerFlags.cmake cmake/QtCompilerOptimization.cmake cmake/QtFeature.cmake cmake/QtPlatformSupport.cmake diff --git a/cmake/QtCompilerFlags.cmake b/cmake/QtCompilerFlags.cmake new file mode 100644 index 0000000000..35733027f5 --- /dev/null +++ b/cmake/QtCompilerFlags.cmake @@ -0,0 +1,6 @@ +# Set warnings. All compilers except MSVC support -Wall -Wextra +if (MSVC) + add_compile_options(/W3) +else() + add_compile_options(-Wall -Wextra) +endif() diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake index a90f12d0c2..caf908b4c9 100644 --- a/cmake/QtSetup.cmake +++ b/cmake/QtSetup.cmake @@ -42,6 +42,9 @@ include(QtFeature) ## Compiler optimization flags: include(QtCompilerOptimization) +## Compiler flags: +include(QtCompilerFlags) + ## Find host tools (if non native): set(HOST_QT_TOOLS_DIRECTORY "" CACHE PATH "Directory with Qt host tools.") |