From 1b240c8d4d427bf16a8fc0cf7ad4e831620aa2e6 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Fri, 16 Apr 2021 01:15:52 +0200 Subject: [PATCH] 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. --- misc/mxnet/files/patch-CMakeLists.txt | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/misc/mxnet/files/patch-CMakeLists.txt b/misc/mxnet/files/patch-CMakeLists.txt index 8c50b22bf675..239130b5f5ee 100644 --- a/misc/mxnet/files/patch-CMakeLists.txt +++ b/misc/mxnet/files/patch-CMakeLists.txt @@ -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)