diff --git a/cmake-modules/SetCXXCompilerFlags.cmake b/cmake-modules/SetCXXCompilerFlags.cmake index b02800d518..25f909438a 100644 --- a/cmake-modules/SetCXXCompilerFlags.cmake +++ b/cmake-modules/SetCXXCompilerFlags.cmake @@ -9,8 +9,14 @@ function(set_darma_compiler_flags vt_target) if (APPLE) list(APPEND TARGET_PUBLIC_CXX_FLAGS -stdlib=libc++) endif () - elseif (CMAKE_CXX_COMPILER_ID STREQUAL IntelLLVM AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 2021.3.0) + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 2021.3.0) list(APPEND TARGET_PRIVATE_CXX_FLAGS -fhonor-infinites -fhonor-nans) + elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel") + # Intel classic (icpc) + # Set as PUBLIC because we want to propagate it to "derived" targets + # gtest-main links with gtest, while VT's tests link with base VT + list(APPEND TARGET_PUBLIC_CXX_FLAGS -diag-disable=10441) + list(APPEND TARGET_PUBLIC_LINK_FLAGS -diag-disable=10441) elseif (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Intel") message(FATAL_ERROR "Your C++ compiler may not support C++14.") endif () @@ -26,9 +32,11 @@ function(set_darma_compiler_flags vt_target) endif() endif() - message(DEBUG "Target ${vt_target} public compile options: ${TARGET_PUBLIC_CXX_FLAGS}") + message(DEBUG "Target ${vt_target} public compile options: ${TARGET_PUBLIC_CXX_FLAGS} \n public link options: ${TARGET_PUBLIC_LINK_FLAGS}") target_compile_options(${vt_target} PUBLIC ${TARGET_PUBLIC_CXX_FLAGS}) + target_link_options(${vt_target} PUBLIC ${TARGET_PUBLIC_LINK_FLAGS}) message(DEBUG "Target ${vt_target} private compile options: ${TARGET_PRIVATE_CXX_FLAGS}") target_compile_options(${vt_target} PRIVATE ${TARGET_PRIVATE_CXX_FLAGS}) + endfunction() diff --git a/cmake/load_bundled_libraries.cmake b/cmake/load_bundled_libraries.cmake index 96146ad6d3..c2773a24ad 100644 --- a/cmake/load_bundled_libraries.cmake +++ b/cmake/load_bundled_libraries.cmake @@ -41,9 +41,12 @@ set(BROTLI_DISABLE_TESTS ON) # we need to disable bundled mode so it will install properly set(BROTLI_BUNDLED_MODE OFF) set(BROTLI_BUILD_PORTABLE ON) -set(BROTLI_LIBRARY brotlicommon-static brotlienc-static brotlidec-static) +set(BROTLI_BUILD_SHARED_LIBS OFF) +set(BROTLI_LIBRARY brotlicommon-static brotlidec-static brotlienc-static) add_subdirectory(${PROJECT_LIB_DIR}/brotli) -set_darma_compiler_flags(${BROTLI_LIBRARY}) +foreach(lib ${BROTLI_LIBRARY}) + set_darma_compiler_flags(${lib}) +endforeach() # Optionally include mimalloc (alternative memory allocator) if (vt_mimalloc_enabled) diff --git a/lib/brotli/CMakeLists.txt b/lib/brotli/CMakeLists.txt index 4f120cb243..6489daf735 100644 --- a/lib/brotli/CMakeLists.txt +++ b/lib/brotli/CMakeLists.txt @@ -162,7 +162,7 @@ endfunction() transform_sources_list("scripts/sources.lst" "${CMAKE_CURRENT_BINARY_DIR}/sources.lst.cmake") include("${CMAKE_CURRENT_BINARY_DIR}/sources.lst.cmake") -if(BROTLI_EMSCRIPTEN) +if(BROTLI_EMSCRIPTEN OR NOT BROTLI_BUILD_SHARED_LIBS) set(BROTLI_SHARED_LIBS "") else() set(BROTLI_SHARED_LIBS brotlicommon brotlidec brotlienc) @@ -206,7 +206,7 @@ foreach(lib IN LISTS BROTLI_SHARED_LIBS BROTLI_STATIC_LIBS) # set_property(TARGET ${lib} APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${BROTLI_INCLUDE_DIRS}") endforeach() -if(NOT BROTLI_EMSCRIPTEN) +if(NOT BROTLI_EMSCRIPTEN AND BROTLI_BUILD_SHARED_LIBS) target_link_libraries(brotlidec brotlicommon) target_link_libraries(brotlienc brotlicommon) endif() @@ -230,7 +230,7 @@ add_executable(brotli ${BROTLI_CLI_C}) target_link_libraries(brotli ${BROTLI_LIBRARIES_STATIC}) # Installation -if(NOT BROTLI_EMSCRIPTEN) +if(NOT BROTLI_EMSCRIPTEN AND BROTLI_BUILD_SHARED_LIBS) if(NOT BROTLI_BUNDLED_MODE) install( TARGETS brotli