From 2a483deb854cb96e0ab17bd87ec4f2ddbb71c5d0 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Wed, 23 Aug 2017 23:12:56 +0200 Subject: [PATCH] work around test suite compilation issues on MSVC2017 --- CMakeLists.txt | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b31eac9..4ea7852 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,10 +8,6 @@ if(POLICY CMP0058) cmake_policy(SET CMP0058 NEW) endif() -if (POLICY CMP0023) - cmake_policy(SET CMP0023 OLD) -endif() - if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) message(STATUS "Setting build type to 'Release' as none was specified.") set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) @@ -333,7 +329,7 @@ if(TBB_BUILD_TBBMALLOC_PROXY) add_library(tbbmalloc_proxy SHARED ${tbbmalloc_proxy_src}) set_property(TARGET tbbmalloc_proxy APPEND PROPERTY COMPILE_DEFINITIONS "__TBBMALLOC_BUILD=1") set_property(TARGET tbbmalloc_proxy APPEND_STRING PROPERTY COMPILE_FLAGS ${DISABLE_RTTI}) - target_link_libraries(tbbmalloc_proxy tbbmalloc) + target_link_libraries(tbbmalloc_proxy PUBLIC tbbmalloc) install(TARGETS tbbmalloc_proxy LIBRARY DESTINATION ${TBB_INSTALL_LIBRARY_DIR} ARCHIVE DESTINATION ${TBB_INSTALL_ARCHIVE_DIR} @@ -376,27 +372,27 @@ if (TBB_BUILD_TESTS) set (full_testname tbb_test_${testname}) add_executable (${full_testname} src/test/test_${testname}.cpp) if (TBB_BUILD_SHARED) - target_link_libraries (${full_testname} tbb tbbmalloc) + target_link_libraries (${full_testname} PRIVATE tbb tbbmalloc) target_compile_definitions (${full_testname} PRIVATE __TBB_LIB_NAME=tbb) else () - target_link_libraries (${full_testname} tbb_static tbbmalloc_static) + target_link_libraries (${full_testname} PRIVATE tbb_static tbbmalloc_static) target_compile_definitions (${full_testname} PRIVATE __TBB_LIB_NAME=tbb_static) endif () if (LIBRT_LIBRARIES) - target_link_libraries (${full_testname} ${LIBRT_LIBRARIES}) + target_link_libraries (${full_testname} PRIVATE ${LIBRT_LIBRARIES}) endif () if (LIDL_LIBRARIES) - target_link_libraries (${full_testname} ${LIDL_LIBRARIES}) + target_link_libraries (${full_testname} PRIVATE ${LIDL_LIBRARIES}) endif () if (Threads_FOUND) - target_link_libraries (${full_testname} ${CMAKE_THREAD_LIBS_INIT}) + target_link_libraries (${full_testname} PRIVATE ${CMAKE_THREAD_LIBS_INIT}) endif () if (OPENMP_FOUND AND "${testname}" MATCHES "openmp") set_target_properties (${full_testname} PROPERTIES COMPILE_FLAGS "${OpenMP_CXX_FLAGS}") set_target_properties (${full_testname} PROPERTIES LINK_FLAGS "${OpenMP_CXX_FLAGS}") endif() if (MINGW) - target_link_libraries (${full_testname} psapi) + target_link_libraries (${full_testname} PRIVATE psapi) endif () add_test (NAME ${full_testname} COMMAND ${full_testname}) endmacro () @@ -413,7 +409,9 @@ if (TBB_BUILD_TESTS) tbb_add_test (broadcast_node) tbb_add_test (buffer_node) tbb_add_test (cache_aligned_allocator) - tbb_add_test (cache_aligned_allocator_STL) + if (NOT WIN32) + tbb_add_test (cache_aligned_allocator_STL) + endif() tbb_add_test (cilk_dynamic_load) tbb_add_test (cilk_interop) tbb_add_test (combinable) @@ -471,7 +469,9 @@ if (TBB_BUILD_TESTS) endif () tbb_add_test (overwrite_node) # tbb_add_test (parallel_do) - tbb_add_test (parallel_for) + if (NOT WIN32) + tbb_add_test (parallel_for) + endif() tbb_add_test (parallel_for_each) tbb_add_test (parallel_for_vectorization) tbb_add_test (parallel_invoke) @@ -489,7 +489,9 @@ if (TBB_BUILD_TESTS) # tbb_add_test (runtime_loader) # LINK : fatal error LNK1104: cannot open file 'tbbproxy.lib' [C:\projects\tbb\test_runtime_loader.vcxproj] tbb_add_test (rwm_upgrade_downgrade) # tbb_add_test (ScalableAllocator) - tbb_add_test (ScalableAllocator_STL) + if (NOT WIN32) + tbb_add_test (ScalableAllocator_STL) + endif() tbb_add_test (semaphore) # tbb_add_test (sequencer_node) # msvc: timeout tbb_add_test (source_node)