Skip to content

Commit

Permalink
error if using Enzyme with gcc/g++ (#1883)
Browse files Browse the repository at this point in the history
* error if using Enzyme with gcc/g++

* nicer error

* reduce error to warning

* more precise warning message
  • Loading branch information
ZuseZ4 committed May 15, 2024
1 parent cf89592 commit f5e66b2
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
20 changes: 20 additions & 0 deletions enzyme/cmake/EnzymeConfig.cmake.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# - Config file for the Enzyme package

get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES)

if("C" IN_LIST languages)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
message("project languages: ${languages}")
message(WARNING "C compiler ID equals ${CMAKE_C_COMPILER_ID}\n"
"C compiler: ${CMAKE_C_COMPILER}\n"
"Using Enzyme without an LLVM based C compiler.")
endif()
endif()

if("CXX" IN_LIST languages)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
message("project languages: ${languages}")
message(WARNING "C++ compiler equals ${CMAKE_CXX_COMPILER_ID}\n"
"C++ compiler: ${CMAKE_CXX_COMPILER}\n"
"Using Enzyme without an LLVM based C++ compiler.")
endif()
endif()

# Compute paths
get_filename_component(Enzyme_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(Enzyme_LLVM_VERSION_MAJOR "@CONF_LLVM_VERSION_MAJOR@")
Expand Down
20 changes: 20 additions & 0 deletions enzyme/cmake/EnzymeConfigVersion.cmake.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
set(PACKAGE_VERSION "@ENZYME_VERSION@")

get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES)

if("C" IN_LIST languages)
if ("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU")
message("project languages: ${languages}")
message(WARNING "C compiler ID equals ${CMAKE_C_COMPILER_ID}\n"
"C compiler: ${CMAKE_C_COMPILER}\n"
"Using Enzyme without an LLVM based C compiler.")
endif()
endif()

if("CXX" IN_LIST languages)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
message("project languages: ${languages}")
message(WARNING "C++ compiler equals ${CMAKE_CXX_COMPILER_ID}\n"
"C++ compiler: ${CMAKE_CXX_COMPILER}\n"
"Using Enzyme without an LLVM based C++ compiler.")
endif()
endif()

# Check whether the requested PACKAGE_FIND_VERSION is compatible
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
Expand Down

0 comments on commit f5e66b2

Please sign in to comment.