Skip to content

Commit 9807e9d

Browse files
committed
Build: Fixed CMake 3.30 FindBoost deprecation warning
(cherry picked from commit ab5fab5ee9fd0dde509d19ffc26503379a02c41b)
1 parent 8cbb263 commit 9807e9d

File tree

5 files changed

+39
-15
lines changed

5 files changed

+39
-15
lines changed

dep/boost/CMakeLists.txt

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,50 @@
88
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
99
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
1010

11+
set(BOOST_SEARCH_HINTS)
1112
if(WIN32)
1213
if(DEFINED ENV{BOOST_ROOT})
1314
set(BOOST_ROOT $ENV{BOOST_ROOT})
1415
endif()
16+
if(DEFINED BOOST_ROOT AND MSVC)
17+
# insert a dot (.) character before last digit of MSVC_TOOLSET_VERSION
18+
# turn 143 into 14.3
19+
string(LENGTH "${MSVC_TOOLSET_VERSION}" _BOOST_MSVC_TOOLSET_VERSION_LENGTH)
20+
math(EXPR _BOOST_MSVC_TOOLSET_VERSION_LENGTH "${_BOOST_MSVC_TOOLSET_VERSION_LENGTH} - 1" OUTPUT_FORMAT DECIMAL)
21+
string(SUBSTRING "${MSVC_TOOLSET_VERSION}" 0 ${_BOOST_MSVC_TOOLSET_VERSION_LENGTH} _BOOST_MSVC_TOOLSET_VERSION_MAJOR)
22+
string(SUBSTRING "${MSVC_TOOLSET_VERSION}" ${_BOOST_MSVC_TOOLSET_VERSION_LENGTH} -1 _BOOST_MSVC_TOOLSET_VERSION_MINOR)
23+
24+
set(BOOST_SEARCH_HINTS "${BOOST_ROOT}/lib${PLATFORM}-msvc-${_BOOST_MSVC_TOOLSET_VERSION_MAJOR}.${_BOOST_MSVC_TOOLSET_VERSION_MINOR}/cmake")
25+
26+
unset(_BOOST_MSVC_TOOLSET_VERSION_LENGTH)
27+
unset(_BOOST_MSVC_TOOLSET_VERSION_MAJOR)
28+
unset(_BOOST_MSVC_TOOLSET_VERSION_MINOR)
29+
endif()
1530

1631
set(Boost_USE_STATIC_LIBS ON)
1732
set(Boost_USE_MULTITHREADED ON)
1833
set(Boost_USE_STATIC_RUNTIME OFF)
1934
endif()
2035

21-
set(Boost_NO_WARN_NEW_VERSIONS ON)
22-
2336
if (WIN32)
2437
# On windows the requirements are higher according to the wiki.
2538
set(BOOST_REQUIRED_VERSION 1.78)
2639
else()
2740
set(BOOST_REQUIRED_VERSION 1.74)
2841
endif()
2942

30-
find_package(Boost ${BOOST_REQUIRED_VERSION} REQUIRED system filesystem program_options iostreams regex locale)
43+
find_package(Boost ${BOOST_REQUIRED_VERSION}
44+
REQUIRED
45+
COMPONENTS
46+
system
47+
filesystem
48+
program_options
49+
iostreams
50+
regex
51+
locale
52+
CONFIG
53+
HINTS
54+
${BOOST_SEARCH_HINTS})
3155

3256
if(NOT Boost_FOUND)
3357
if(NOT DEFINED ENV{BOOST_ROOT} AND NOT DEFINED Boost_DIR AND NOT DEFINED BOOST_ROOT AND NOT DEFINED BOOSTROOT)

src/common/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ target_include_directories(common
4747
PRIVATE
4848
${CMAKE_CURRENT_BINARY_DIR})
4949

50-
target_compile_definitions(common
51-
PRIVATE
52-
TRINITY_API_EXPORT_COMMON)
50+
set_target_properties(common
51+
PROPERTIES
52+
DEFINE_SYMBOL TRINITY_API_EXPORT_COMMON)
5353

5454
target_link_libraries(common
5555
PRIVATE

src/server/database/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ target_include_directories(database
3636
PRIVATE
3737
${CMAKE_CURRENT_BINARY_DIR})
3838

39-
target_compile_definitions(database
40-
PRIVATE
41-
TRINITY_API_EXPORT_DATABASE)
39+
set_target_properties(database
40+
PROPERTIES
41+
DEFINE_SYMBOL TRINITY_API_EXPORT_DATABASE)
4242

4343
target_link_libraries(database
4444
PRIVATE

src/server/game/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ target_include_directories(game
4646
PRIVATE
4747
${CMAKE_CURRENT_BINARY_DIR})
4848

49-
target_compile_definitions(game
50-
PRIVATE
51-
TRINITY_API_EXPORT_GAME)
49+
set_target_properties(game
50+
PROPERTIES
51+
DEFINE_SYMBOL TRINITY_API_EXPORT_GAME)
5252

5353
target_link_libraries(game
5454
PRIVATE

src/server/shared/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ target_include_directories(shared
3737
PRIVATE
3838
${CMAKE_CURRENT_BINARY_DIR})
3939

40-
target_compile_definitions(shared
41-
PRIVATE
42-
TRINITY_API_EXPORT_SHARED)
40+
set_target_properties(shared
41+
PROPERTIES
42+
DEFINE_SYMBOL TRINITY_API_EXPORT_SHARED)
4343

4444
target_link_libraries(shared
4545
PRIVATE

0 commit comments

Comments
 (0)