Skip to content
Snippets Groups Projects
Commit 38068aaf authored by Santiago Ospina De Los Ríos's avatar Santiago Ospina De Los Ríos Committed by Timo Koch
Browse files

Add Threads library dependency and propagate pthreads flag

parent 99387d38
No related branches found
No related tags found
1 merge request!1464[cmake] Require linked libs through find_dependency
Pipeline #75738 passed
Pipeline: Dune Nightly Test

#75741

    Pipeline: Dune Nightly Test

    #75740

      ......@@ -12,6 +12,8 @@ endif()
      # make sure our own modules are found
      list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
      set(THREADS_PREFER_PTHREAD_FLAG TRUE CACHE BOOL "Prefer -pthread compiler and linker flag")
      #include the dune macros
      include(DuneMacros)
      ......@@ -35,7 +37,8 @@ add_dune_blas_lapack_flags(dunecommon)
      add_dune_tbb_flags(dunecommon)
      # collect dependencies to be added into the dune-common-config.cmake files
      set(DUNE_COMMON_PACKAGE_DEPENDENCIES)
      set(DUNE_COMMON_PACKAGE_DEPENDENCIES
      [[set(THREADS_PREFER_PTHREAD_FLAG TRUE CACHE BOOL "Prefer -pthread compiler and linker flag")]])
      # since dunecommon is exported its linked libs must be provided downstream too
      if (LAPACK_FOUND)
      ......@@ -43,6 +46,9 @@ if (LAPACK_FOUND)
      elseif (BLAS_FOUND)
      list(APPEND DUNE_COMMON_PACKAGE_DEPENDENCIES "find_dependency(BLAS)")
      endif()
      if (Threads_FOUND)
      list(APPEND DUNE_COMMON_PACKAGE_DEPENDENCIES "find_dependency(Threads)")
      endif()
      if (TBB_FOUND)
      list(APPEND DUNE_COMMON_PACKAGE_DEPENDENCIES "find_dependency(TBB)")
      endif()
      ......@@ -60,14 +66,12 @@ if(DUNE_ENABLE_PYTHONBINDINGS)
      add_subdirectory(python)
      endif()
      if(DUNE_COMMON_PACKAGE_DEPENDENCIES)
      # write contents into DUNE_CUSTOM_PKG_CONFIG_SECTION, which will be injected into dune-common-config.cmake
      string(JOIN "\n" DUNE_CUSTOM_PKG_CONFIG_SECTION
      # make sure that Find<module>.cmake provided by dune-common can be found by cmake
      [[list(APPEND CMAKE_MODULE_PATH "${dune-common_MODULE_PATH}")]]
      ${DUNE_COMMON_PACKAGE_DEPENDENCIES}
      )
      endif()
      # write contents into DUNE_CUSTOM_PKG_CONFIG_SECTION, which will be injected into dune-common-config.cmake
      string(JOIN "\n" DUNE_CUSTOM_PKG_CONFIG_SECTION
      # make sure that Find<module>.cmake provided by dune-common can be found by cmake
      [[list(APPEND CMAKE_MODULE_PATH "${dune-common_MODULE_PATH}")]]
      ${DUNE_COMMON_PACKAGE_DEPENDENCIES}
      )
      # finalize the dune project, e.g. generating config.h, dune-common-config.cmake, etc.
      finalize_dune_project()
      ......@@ -30,10 +30,6 @@ include_guard(GLOBAL)
      enable_language(C) # Enable C to skip CXX bindings for some tests.
      # By default use -pthread flag. This option is set at the beginning to enforce it for
      # find_package(Threads) everywhere
      set(THREADS_PREFER_PTHREAD_FLAG TRUE CACHE BOOL "Prefer -pthread compiler and linker flag")
      include(DuneAddLibrary)
      include(DuneDefaultIncludeDirectories)
      include(DuneEnableAllPackages)
      ......
      0% Loading or .
      You are about to add 0 people to the discussion. Proceed with caution.
      Finish editing this message first!
      Please register or to comment