Skip to content

Commit de27e4f

Browse files
authored
Stop DYNAMIC_ARCH build if the toplevel source contains a stray config_kernel.h from a gmake build
This is unlikely to happen in practice, but if it does, the rogue file would get included instead of the dynamically generated version for each target_core, leading to very confusing errors like "invalid operands (undefined UND and ABS sections)" in compilation of the assembly kernels as macros like PREFETCH would remain undefined
1 parent 2367726 commit de27e4f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cmake/arch.cmake

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
##
21
## Author: Hank Anderson <[email protected]>
32
## Description: Ported from portion of OpenBLAS/Makefile.system
43
## Sets various variables based on architecture.
@@ -80,10 +79,15 @@ if (DYNAMIC_ARCH)
8079
string(REGEX REPLACE "-march=native" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
8180
endif ()
8281
if (DYNAMIC_LIST)
83-
set(DYNAMIC_CORE PRESCOTT ${DYNAMIC_LIST})
82+
set(DYNAMIC_CORE ${DYNAMIC_LIST})
8483
endif ()
8584
endif ()
8685

86+
CHECK_INCLUDE_FILE ("${PROJECT_SOURCE_DIR}/config_kernel.h" TRAP)
87+
if (TRAP)
88+
message (FATAL_ERROR "Your build directory contains a file config_kernel.h, probably from a previous compilation with make. This will conflict with the cmake compilation and cause strange compiler errors - please remove the file before trying again")
89+
endif ()
90+
8791
if (NOT DYNAMIC_CORE)
8892
message (STATUS "DYNAMIC_ARCH is not supported on this architecture, removing from options")
8993
unset(DYNAMIC_ARCH CACHE)

0 commit comments

Comments
 (0)