Browse Source

CMake: Link gperftools directly to the binary

Not sure why this is necessary but it fixes the gperf build
pull/4015/head
Gleb Mazovetskiy 4 years ago committed by Anders Jenbo
parent
commit
6bcac742ed
  1. 5
      CMake/Dependencies.cmake
  2. 4
      CMake/functions/devilutionx_library.cmake
  3. 4
      CMakeLists.txt
  4. 4
      Source/CMakeLists.txt
  5. 3
      test/CMakeLists.txt

5
CMake/Dependencies.cmake

@ -190,3 +190,8 @@ if(BUILD_TESTING)
add_subdirectory(3rdParty/googletest)
endif()
endif()
if(GPERF)
find_package(Gperftools REQUIRED)
message("INFO: ${GPERFTOOLS_LIBRARIES}")
endif()

4
CMake/functions/devilutionx_library.cmake

@ -30,10 +30,6 @@ function(add_devilutionx_library NAME)
target_link_libraries(${NAME} PUBLIC "$<${ASAN_GENEX}:-fsanitize=address;-fsanitize-recover=address>")
endif()
if(GPERF)
target_link_libraries(${NAME} PUBLIC ${GPERFTOOLS_LIBRARIES})
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
genex_for_option(DEVILUTIONX_STATIC_CXX_STDLIB)
target_link_libraries(${NAME} PUBLIC $<${DEVILUTIONX_STATIC_CXX_STDLIB_GENEX}:-static-libgcc;-static-libstdc++>)

4
CMakeLists.txt

@ -226,6 +226,10 @@ if(NOT UWP_LIB)
target_link_libraries(${BIN_TARGET} PRIVATE libdevilutionx)
endif()
if(GPERF)
target_link_libraries(${BIN_TARGET} PUBLIC ${GPERFTOOLS_LIBRARIES})
endif()
# Must be included after `BIN_TARGET` and `libdevilutionx` are defined.
include(Assets)

4
Source/CMakeLists.txt

@ -218,10 +218,6 @@ if(DISCORD_INTEGRATION)
target_link_libraries(libdevilutionx PRIVATE discord discord_game_sdk)
endif()
if(GPERF)
find_package(Gperftools REQUIRED)
endif()
target_link_libraries(libdevilutionx PUBLIC
Threads::Threads
DevilutionX::SDL

3
test/CMakeLists.txt

@ -40,6 +40,9 @@ foreach(test_target ${tests})
gtest_discover_tests(${test_target})
target_link_libraries(${test_target} PRIVATE test_main)
set_target_properties(${test_target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${DevilutionX_BINARY_DIR})
if(GPERF)
target_link_libraries(${test_target} PUBLIC ${GPERFTOOLS_LIBRARIES})
endif()
endforeach()
target_include_directories(writehero_test PRIVATE ../3rdParty/PicoSHA2)

Loading…
Cancel
Save