Skip to content

Commit

Permalink
Sets OCCA_<MODE>_ENABLED in CMake parent scope. (#720)
Browse files Browse the repository at this point in the history
Intended for CMake builds which add occa as a subdirectory.
  • Loading branch information
kris-rowe committed Jan 24, 2024
1 parent 1869028 commit 06e32fd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.17 FATAL_ERROR)
cmake_minimum_required (VERSION 3.21 FATAL_ERROR)

#---[ CMake Config ]--------------------
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
Expand Down Expand Up @@ -244,6 +244,16 @@ if(ENABLE_METAL AND APPLE)
endif()
endif()
#=======================================

if(NOT OCCA_IS_TOP_LEVEL)
# OCCA is being built as a subdirectory in another project
set(OCCA_OPENMP_ENABLED ${OCCA_OPENMP_ENABLED} PARENT_SCOPE)
set(OCCA_CUDA_ENABLED ${OCCA_CUDA_ENABLED} PARENT_SCOPE)
set(OCCA_HIP_ENABLED ${OCCA_HIP_ENABLED} PARENT_SCOPE)
set(OCCA_DPCPP_ENABLED ${OCCA_DPCPP_ENABLED} PARENT_SCOPE)
set(OCCA_OPENCL_ENABLED ${OCCA_OPENCL_ENABLED} PARENT_SCOPE)
set(OCCA_METAL_ENABLED ${OCCA_METAL_ENABLED} PARENT_SCOPE)
endif()

# Generate CompiledDefines from libraries we found
configure_file(
Expand Down

0 comments on commit 06e32fd

Please sign in to comment.