Skip to content

Commit

Permalink
llvm-openmp: tweak CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed Jan 16, 2024
1 parent 156c00b commit 73268e7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
20 changes: 10 additions & 10 deletions recipes/llvm-openmp/all/cmake/conan-llvm-openmp-wrapper.cmake
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Set CMake's FindOpenMP.cmake input variables
set(OpenMP_C_INCLUDE_DIR "${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR}")
set(OpenMP_CXX_INCLUDE_DIR "${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR}")
set(OpenMP_Fortran_INCLUDE_DIR "${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR}")
set(OpenMP_C_INCLUDE_DIR "${OpenMP_INCLUDE_DIR}")
set(OpenMP_CXX_INCLUDE_DIR "${OpenMP_INCLUDE_DIR}")
set(OpenMP_Fortran_INCLUDE_DIR "${OpenMP_INCLUDE_DIR}")

# Unset all variables set by CMakeDeps
unset(${CMAKE_FIND_PACKAGE_NAME}_FOUND)
unset(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIR)
unset(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS)
unset(${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES)
unset(${CMAKE_FIND_PACKAGE_NAME}_DEFINITIONS)
unset(${CMAKE_FIND_PACKAGE_NAME}_VERSION)
unset(${CMAKE_FIND_PACKAGE_NAME}_VERSION_STRING)
unset(OpenMP_FOUND)
unset(OpenMP_INCLUDE_DIR)
unset(OpenMP_INCLUDE_DIRS)
unset(OpenMP_LIBRARIES)
unset(OpenMP_DEFINITIONS)
unset(OpenMP_VERSION)
unset(OpenMP_VERSION_STRING)

# Delegate to CMake's FindOpenMP.cmake
set(_CMAKE_MODULE_PATH_TMP ${CMAKE_MODULE_PATH})
Expand Down
13 changes: 7 additions & 6 deletions recipes/llvm-openmp/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ project(PackageTest CXX C)
find_package(OpenMP MODULE REQUIRED)

message("OpenMP_FOUND: ${OpenMP_CXX_FOUND}")
message("OpenMP_C_FOUND: ${OpenMP_CXX_FOUND}")
message("OpenMP_CXX_FOUND: ${OpenMP_CXX_FOUND}")
message("OpenMP_CXX_VERSION: ${OpenMP_CXX_VERSION}")
message("OpenMP_CXX_SPEC_DATE: ${OpenMP_CXX_SPEC_DATE}")
message("OpenMP_CXX_INCLUDE_DIRS: ${OpenMP_CXX_INCLUDE_DIRS}")
message("OpenMP_INCLUDE_DIRS: ${OpenMP_CXX_INCLUDE_DIRS}")
message("OpenMP_CXX_LIB_NAMES: ${OpenMP_CXX_LIB_NAMES}")
message("OpenMP_CXX_LIBRARY: ${OpenMP_CXX_LIBRARY}")
message("OpenMP_CXX_LIBRARIES: ${OpenMP_CXX_LIBRARIES}")
message("OpenMP_CXX_FLAGS: ${OpenMP_CXX_FLAGS}")

if(NOT DEFINED OpenMP_C_INCLUDE_DIRS)
message(FATAL_ERROR "OpenMP_C_INCLUDE_DIRS is not defined")
endif()
if(NOT DEFINED OpenMP_CXX_INCLUDE_DIRS)
message(FATAL_ERROR "OpenMP_CXX_INCLUDE_DIRS is not defined")
if(NOT DEFINED OpenMP_CXX_SPEC_DATE)
message(FATAL_ERROR "FindOpenMP.cmake did not set all variables correctly.")
endif()

add_executable(test_package_cxx test_package.cpp)
Expand Down

0 comments on commit 73268e7

Please sign in to comment.