Browse Source

Merge pull request #11005 from glassez/cmake

Fix/Improve Cmake scripts
adaptive-webui-19844
Vladimir Golovnev 5 years ago committed by GitHub
parent
commit
f4329779e9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      CMakeLists.txt
  2. 22
      cmake/Modules/MacroQbtCompilerSettings.cmake
  3. 2
      cmake/Modules/winconf-msvc.cmake
  4. 1
      cmake/Modules/winconf.cmake

4
CMakeLists.txt

@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.9 FATAL_ERROR) @@ -2,6 +2,10 @@ cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
message(AUTHOR_WARNING "If the build fails, please try the autotools/qmake method.")
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
include(FunctionReadVersion)

22
cmake/Modules/MacroQbtCompilerSettings.cmake

@ -73,30 +73,30 @@ macro(qbt_set_compiler_options) @@ -73,30 +73,30 @@ macro(qbt_set_compiler_options)
string(APPEND CMAKE_C_FLAGS " ${_GCC_COMMON_C_AND_CXX_FLAGS_STRING}")
string(APPEND CMAKE_CXX_FLAGS " ${_GCC_COMMON_C_AND_CXX_FLAGS_STRING} ${_GCC_COMMON_CXX_FLAGS_STRING}")
set(QBT_ADDITONAL_FLAGS "${_GCC_COMMON_C_AND_CXX_FLAGS_STRING}" CACHE STRING
"Additional qBittorent compile flags" FORCE)
set(QBT_ADDITONAL_CXX_FLAGS "${_GCC_COMMON_CXX_FLAGS_STRING}" CACHE STRING
"Additional qBittorent C++ compile flags" FORCE)
# check whether we can enable -Og optimization for debug build
# also let's enable -march=native for debug builds
check_cxx_compiler_flag(-Og _DEBUG_OPTIMIZATION_LEVEL_IS_SUPPORTED)
if (_DEBUG_OPTIMIZATION_LEVEL_IS_SUPPORTED)
string(APPEND CMAKE_C_FLAGS_DEBUG " -Og -g3 -march=native -pipe" )
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -Og -g3 -march=native -pipe" )
set(QBT_ADDITONAL_FLAGS "-Og -g3 -march=native -pipe" CACHE STRING
"Additional qBittorent compile flags")
set(QBT_ADDITONAL_CXX_FLAGS "-Og -g3 -march=native -pipe" CACHE STRING
"Additional qBittorent C++ compile flags")
else(_DEBUG_OPTIMIZATION_LEVEL_IS_SUPPORTED)
string(APPEND CMAKE_C_FLAGS_DEBUG " -O0 -g3 -march=native -pipe" )
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -O0 -g3 -march=native -pipe" )
set(QBT_ADDITONAL_FLAGS "-O0 -g3 -march=native -pipe" CACHE STRING
"Additional qBittorent compile flags")
set(QBT_ADDITONAL_CXX_FLAGS "-O0 -g3 -march=native -pipe" CACHE STRING
"Additional qBittorent C++ compile flags")
endif (_DEBUG_OPTIMIZATION_LEVEL_IS_SUPPORTED)
endif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(QBT_ADDITONAL_FLAGS "-wd4290 -wd4275 -wd4251 /W4" CACHE STRING "Additional qBittorent compile flags")
string(APPEND CMAKE_C_FLAGS " ${QBT_ADDITONAL_FLAGS}")
string(APPEND CMAKE_CXX_FLAGS " ${QBT_ADDITONAL_FLAGS}")
endif ()
string(APPEND CMAKE_C_FLAGS " ${QBT_ADDITONAL_FLAGS}")
string(APPEND CMAKE_CXX_FLAGS " ${QBT_ADDITONAL_FLAGS}")
# endif (NOT QBT_ADDITONAL_FLAGS)
endmacro(qbt_set_compiler_options)

2
cmake/Modules/winconf-msvc.cmake

@ -4,7 +4,7 @@ if (STACKTRACE) @@ -4,7 +4,7 @@ if (STACKTRACE)
add_compile_options(-Oy-)
endif (NOT "${WINXXBITS}" STREQUAL "Win64")
add_compile_options(-Zi)
link_libraries(dbghelp.lib /DEBUG)
link_libraries(dbghelp -DEBUG)
endif (STACKTRACE)
include(MacroConfigureMSVCRuntime)

1
cmake/Modules/winconf.cmake

@ -30,6 +30,7 @@ add_definitions(-DUNICODE @@ -30,6 +30,7 @@ add_definitions(-DUNICODE
-D_CRT_SECURE_NO_DEPRECATE
-D_SCL_SECURE_NO_DEPRECATE
-DNOMINMAX
-DBOOST_ALL_NO_LIB
)
# Enable if libtorrent was built with this flag defined

Loading…
Cancel
Save