1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-26 05:02:18 +00:00

misc/mxnet: don't build the tests if testing is not enabled

Local (testport) builds were failing like so:

ld: error: undefined symbol: testing::Message::GetString() const
>>> referenced by base.cc
>>>               tests/CMakeFiles/mxnet_unit_tests.dir/cpp/misc/base.cc.o:(testing::AssertionResult::AppendMessage(testing::Message const&))

because the testing libraries were not being linked -- because
they're not even searched for when testing is not enabled.
Extend previous patch that put the searching-for-testlibs
behind a check, to apply the same check to building-tests.
This commit is contained in:
Adriaan de Groot 2021-04-16 01:15:52 +02:00
parent e44d8d345d
commit 1b240c8d4d

View File

@ -1,6 +1,6 @@
--- CMakeLists.txt.orig 2019-12-13 19:55:11 UTC
--- CMakeLists.txt.orig 2020-07-15 07:03:28 UTC
+++ CMakeLists.txt
@@ -490,6 +490,7 @@ if(USE_JEMALLOC)
@@ -464,6 +464,7 @@ if(USE_JEMALLOC)
endif()
endif()
@ -8,15 +8,15 @@
include(CTest)
set(GTEST_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/googletest/googletest")
set(GTEST_INCLUDE_DIR ${GTEST_ROOT}/include)
@@ -500,6 +501,7 @@ set(GTEST_LIBRARY gtest)
@@ -474,6 +475,7 @@ set(GTEST_LIBRARY gtest)
add_subdirectory(${GTEST_ROOT})
find_package(GTest REQUIRED)
+endif()
# cudnn detection
if(USE_CUDNN AND USE_CUDA)
@@ -819,7 +821,7 @@ install(TARGETS ${MXNET_INSTALL_TARGETS}
if(USE_CUDNN)
@@ -865,7 +867,7 @@ install(TARGETS ${MXNET_INSTALL_TARGETS}
# https://cmake.org/cmake/help/v3.0/module/GNUInstallDirs.html
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/dlpack/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
@ -25,3 +25,13 @@
if(USE_MKLDNN)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/mkldnn/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()
@@ -913,7 +915,9 @@ endif()
if(BUILD_CPP_EXAMPLES)
add_subdirectory(example/image-classification/predict-cpp)
endif()
+if(ENABLE_TESTING)
add_subdirectory(tests)
+endif()
# ---[ Linter target
if(MSVC)