Skip to content

Commit

Permalink
Build: Fixed CMake 3.30 FindBoost deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
Shauren committed Jul 18, 2024
1 parent b3763c3 commit ab5fab5
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 18 deletions.
30 changes: 27 additions & 3 deletions dep/boost/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,50 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

set(BOOST_SEARCH_HINTS)
if(WIN32)
if(DEFINED ENV{BOOST_ROOT})
set(BOOST_ROOT $ENV{BOOST_ROOT})
endif()
if(DEFINED BOOST_ROOT AND MSVC)
# insert a dot (.) character before last digit of MSVC_TOOLSET_VERSION
# turn 143 into 14.3
string(LENGTH "${MSVC_TOOLSET_VERSION}" _BOOST_MSVC_TOOLSET_VERSION_LENGTH)
math(EXPR _BOOST_MSVC_TOOLSET_VERSION_LENGTH "${_BOOST_MSVC_TOOLSET_VERSION_LENGTH} - 1" OUTPUT_FORMAT DECIMAL)
string(SUBSTRING "${MSVC_TOOLSET_VERSION}" 0 ${_BOOST_MSVC_TOOLSET_VERSION_LENGTH} _BOOST_MSVC_TOOLSET_VERSION_MAJOR)
string(SUBSTRING "${MSVC_TOOLSET_VERSION}" ${_BOOST_MSVC_TOOLSET_VERSION_LENGTH} -1 _BOOST_MSVC_TOOLSET_VERSION_MINOR)

set(BOOST_SEARCH_HINTS "${BOOST_ROOT}/lib${PLATFORM}-msvc-${_BOOST_MSVC_TOOLSET_VERSION_MAJOR}.${_BOOST_MSVC_TOOLSET_VERSION_MINOR}/cmake")

unset(_BOOST_MSVC_TOOLSET_VERSION_LENGTH)
unset(_BOOST_MSVC_TOOLSET_VERSION_MAJOR)
unset(_BOOST_MSVC_TOOLSET_VERSION_MINOR)
endif()

set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
endif()

set(Boost_NO_WARN_NEW_VERSIONS ON)

if (WIN32)
# On windows the requirements are higher according to the wiki.
set(BOOST_REQUIRED_VERSION 1.78)
else()
set(BOOST_REQUIRED_VERSION 1.74)
endif()

find_package(Boost ${BOOST_REQUIRED_VERSION} REQUIRED system filesystem program_options iostreams regex locale)
find_package(Boost ${BOOST_REQUIRED_VERSION}
REQUIRED
COMPONENTS
system
filesystem
program_options
iostreams
regex
locale
CONFIG
HINTS
${BOOST_SEARCH_HINTS})

if(NOT Boost_FOUND)
if(NOT DEFINED ENV{BOOST_ROOT} AND NOT DEFINED Boost_DIR AND NOT DEFINED BOOST_ROOT AND NOT DEFINED BOOSTROOT)
Expand Down
6 changes: 3 additions & 3 deletions src/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ target_include_directories(common
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})

target_compile_definitions(common
PRIVATE
TRINITY_API_EXPORT_COMMON)
set_target_properties(common
PROPERTIES
DEFINE_SYMBOL TRINITY_API_EXPORT_COMMON)

target_link_libraries(common
PRIVATE
Expand Down
6 changes: 3 additions & 3 deletions src/server/database/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ target_include_directories(database
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})

target_compile_definitions(database
PRIVATE
TRINITY_API_EXPORT_DATABASE)
set_target_properties(database
PROPERTIES
DEFINE_SYMBOL TRINITY_API_EXPORT_DATABASE)

target_link_libraries(database
PRIVATE
Expand Down
6 changes: 3 additions & 3 deletions src/server/game/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ target_include_directories(game
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})

target_compile_definitions(game
PRIVATE
TRINITY_API_EXPORT_GAME)
set_target_properties(game
PROPERTIES
DEFINE_SYMBOL TRINITY_API_EXPORT_GAME)

target_link_libraries(game
PRIVATE
Expand Down
6 changes: 3 additions & 3 deletions src/server/proto/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ target_include_directories(proto
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})

target_compile_definitions(proto
PRIVATE
TRINITY_API_EXPORT_PROTO)
set_target_properties(proto
PROPERTIES
DEFINE_SYMBOL TRINITY_API_EXPORT_PROTO)

target_link_libraries(proto
PRIVATE
Expand Down
6 changes: 3 additions & 3 deletions src/server/shared/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ target_include_directories(shared
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})

target_compile_definitions(shared
PRIVATE
TRINITY_API_EXPORT_SHARED)
set_target_properties(shared
PROPERTIES
DEFINE_SYMBOL TRINITY_API_EXPORT_SHARED)

target_link_libraries(shared
PRIVATE
Expand Down

0 comments on commit ab5fab5

Please sign in to comment.