Skip to content

Commit ed201a1

Browse files
author
Joan Massich
committed
Add a bunch of PRINT statements to try to trace the problem
1 parent 6b7f481 commit ed201a1

2 files changed

Lines changed: 61 additions & 11 deletions

File tree

cmake/CheckFunctionExists.cmake

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
# that the function is declared in system headers.
4040

4141
macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
42+
message("DEBUG -- fucn_Exist -- :if ( NOT DEFINED \"${VARIABLE}\" OR \"x${${VARIABLE}}\" STREQUAL \"x${VARIABLE}\" )")
4243
if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}")
4344
set(MACRO_CHECK_FUNCTION_DEFINITIONS
4445
"-DCHECK_FUNCTION_EXISTS=${FUNCTION} ${CMAKE_REQUIRED_FLAGS}")
@@ -57,6 +58,12 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
5758
else()
5859
set(CHECK_FUNCTION_EXISTS_ADD_INCLUDES)
5960
endif()
61+
message("---- sik [begin] --- CHECK_FUNCTION_EXISTS --")
62+
message("MACRO_CHECK_FUNCTION_DEFINITIONS : ${MACRO_CHECK_FUNCTION_DEFINITIONS} ")
63+
message("CMAKE_REQUIRED_LIBRARIES : ${CMAKE_REQUIRED_LIBRARIES} ")
64+
message("CMAKE_REQUIRED_INCLUDES : ${CMAKE_REQUIRED_INCLUDES} ")
65+
message("CHECK_FUNCTION_EXISTS_ADD_INCLUDES : ${CHECK_FUNCTION_EXISTS_ADD_INCLUDES} ")
66+
message("---- sik [end] --- CHECK_FUNCTION_EXISTS --")
6067

6168
if(CMAKE_C_COMPILER_LOADED)
6269
set(_cfe_source ${CMAKE_ROOT}/Modules/CheckFunctionExists.c)
@@ -67,6 +74,19 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
6774
message(FATAL_ERROR "CHECK_FUNCTION_EXISTS needs either C or CXX language enabled")
6875
endif()
6976

77+
message("DEBUG --- func_exist --- ${VARIABLE} = ${${VARIABLE}}")
78+
message("-------- sik [begin] --- TRY_COMPILE_CALL")
79+
message("-------- sik --- CMAKE_BINARY_DIR : ${CMAKE_BINARY_DIR}")
80+
message("-------- sik --- _cfe_source: ${_cfe_source}")
81+
message("-------- sik --- COMPILE_DEFINITIONS CMAKE_REQUIRED_DEFINITIONS : COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}")
82+
message("-------- sik --- CHECK_FUNCTION_EXISTS_ADD_LIBRARIES: ${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}")
83+
message("-------- sik --- CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=MACRO_CHECK_FUNCTION_DEFINITIONS: CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS}")
84+
message("-------- sik --- \"CHECK_FUNCTION_EXISTS_ADD_INCLUDE S\" : \"${CHECK_FUNCTION_EXISTS_ADD_INCLUDES}\"")
85+
message("-------- sik --- OUTPUT_VARIABLE OUTPUT : ${OUTPUT_VARIABLE} ${OUTPUT}")
86+
message("-------- sik [other] --- ")
87+
message("-------- sik --- COMPILE_DEFINITIONS : ${COMPILE_DEFINITIONS}")
88+
message("-------- sik --- CMAKE_FLAGS : ${CMAKE_FLAGS}")
89+
message("-------- sik [end] --- TRY_COMPILE_CALL")
7090
try_compile(${VARIABLE}
7191
${CMAKE_BINARY_DIR}
7292
${_cfe_source}
@@ -77,7 +97,10 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
7797
OUTPUT_VARIABLE OUTPUT)
7898
unset(_cfe_source)
7999

100+
message("DEBUG --- func_exist --- VARIABLE = ${VARIABLE}")
101+
message("DEBUG --- func_exist --- ${VARIABLE} = ${${VARIABLE}}")
80102
if(${VARIABLE})
103+
message("DEBUG --- func_exist --- VARIABLE is true and has value = ${VARIABLE}")
81104
set(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}")
82105
if(NOT CMAKE_REQUIRED_QUIET)
83106
message(STATUS "Looking for ${FUNCTION} - found")
@@ -86,6 +109,7 @@ macro(CHECK_FUNCTION_EXISTS FUNCTION VARIABLE)
86109
"Determining if the function ${FUNCTION} exists passed with the following output:\n"
87110
"${OUTPUT}\n\n")
88111
else()
112+
message("DEBUG --- func_exist --- VARIABLE is false and has value = ${VARIABLE}")
89113
if(NOT CMAKE_REQUIRED_QUIET)
90114
message(STATUS "Looking for ${FUNCTION} - not found")
91115
endif()

cmake/FindBLAS.cmake

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ macro(Check_Fortran_Libraries LIBRARIES _prefix _name _flags _list _thread)
9090
# N.B. _prefix is the prefix applied to the names of all cached variables that
9191
# are generated internally and marked advanced by this macro.
9292

93+
9394
set(_libdir ${ARGN})
9495

9596
set(_libraries_work TRUE)
@@ -105,8 +106,10 @@ if (NOT _libdir)
105106
endif ()
106107
endif ()
107108

109+
108110
foreach(_library ${_list})
109111
set(_combined_name ${_combined_name}_${_library})
112+
#message("DEBUG early stage variable: ${_prefix}${_combined_name}_WORKS is ${${_prefix}${_combined_name}_WORKS}")
110113

111114
if(_libraries_work)
112115
if (BLA_STATIC)
@@ -125,35 +128,50 @@ foreach(_library ${_list})
125128
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} .so.3gf)
126129
endif ()
127130
endif ()
128-
message(${CMAKE_FIND_LIBRARY_SUFFIXES})
131+
# message(${CMAKE_FIND_LIBRARY_SUFFIXES})
129132
find_library(${_prefix}_${_library}_LIBRARY
130133
NAMES ${_library}
131134
HINTS ${_libdir}
132135
)
133-
message("LIBDIR : ${_libdir}")
134-
message(${${_prefix}_${_library}_LIBRARY})
136+
# message("---- sik [begin] --- ")
137+
# message(" LIBDIR : ${_libdir}")
138+
# message(" PREFIX : ${_prefix}")
139+
# message(" LIBRARY : ${_libray}")
140+
# message(" COMMAND : mark advanced : ${${_prefix}_${_library}_LIBRARY}")
141+
# message(" COMMAND : set ${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY} ")
142+
# message(" COMMAND : set _libraries_work ${${_prefix}_${_library}_LIBRARY}")
143+
# message("---- sik [end] ---")
135144
mark_as_advanced(${_prefix}_${_library}_LIBRARY)
136145
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
137146
set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
138147
endif()
139148
endforeach()
140149
if(_libraries_work)
150+
message("DEBUG: _libraries_work is ${_prefix}${_combined_name}_WORKS = ${${_prefix}${_combined_name}_WORKS}")
141151
# Test this combination of libraries.
142152
set(CMAKE_REQUIRED_LIBRARIES ${_flags} ${${LIBRARIES}} ${_thread})
143-
# message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
153+
#message("DEBUG: CMAKE_REQUIRED_LIBRARIES = ${CMAKE_REQUIRED_LIBRARIES}")
154+
#message("DEBUG: before checking, ${LIBRARIES} = ${${LIBRARIES}}")
155+
#message("DEBUG: CMAKE_Fortran_COMPILER_LOADED = ${CMAKE_Fortran_COMPILER_LOADED}")
156+
#message("DEBUG: ${_prefix}${_combined_name}_WORKS before check is ${${_prefix}${_combined_name}_WORKS}")
144157
if (CMAKE_Fortran_COMPILER_LOADED)
158+
#message("DEBUG call: check_fortran_function_exists(\"${_name}\" ${_prefix}${_combined_name}_WORKS)")
145159
check_fortran_function_exists("${_name}" ${_prefix}${_combined_name}_WORKS)
146160
else()
161+
#message("DEBUG call: check_function_exists(\"${_name}_\" ${_prefix}${_combined_name}_WORKS)")
147162
check_function_exists("${_name}_" ${_prefix}${_combined_name}_WORKS)
148163
endif()
164+
#message("DEBUG: ${_prefix}${_combined_name}_WORKS after check is ${${_prefix}${_combined_name}_WORKS}")
149165
set(CMAKE_REQUIRED_LIBRARIES)
150166
mark_as_advanced(${_prefix}${_combined_name}_WORKS)
151167
set(_libraries_work ${${_prefix}${_combined_name}_WORKS})
168+
#message("DEBUG: CMAKE_REQUIRED_LIBRARIES is ${CMAKE_REQUIRED_LIBRARIES}")
169+
message("DEBUG: _libraries_work is ${_prefix}${_combined_name}_WORKS = ${${_prefix}${_combined_name}_WORKS}")
152170
endif()
153171
if(NOT _libraries_work)
154172
set(${LIBRARIES} FALSE)
155173
endif()
156-
# message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
174+
#message("DEBUG: ${LIBRARIES} = ${${LIBRARIES}}")
157175
endmacro()
158176

159177
set(BLAS_LINKER_FLAGS)
@@ -501,7 +519,7 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
501519
else()
502520
find_package(Threads REQUIRED)
503521
endif()
504-
522+
# LIST(APPEND CMAKE_THREAD_LIBS_INIT ${LM})
505523
set(BLAS_SEARCH_LIBS "")
506524

507525
if(BLA_F95)
@@ -654,12 +672,20 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
654672
endif ()
655673

656674
foreach (IT ${BLAS_SEARCH_LIBS})
657-
message("----sik---- DB: get in")
675+
# message("----sik---- DB: get in")
658676
string(REPLACE " " ";" SEARCH_LIBS ${IT})
659677
if (${_LIBRARIES})
660-
message("----sik---- DB: get in _libraries is true")
678+
# message("----sik---- DB: get in _libraries is true")
661679
else ()
662-
message("----sik---- DB: get in _libraries is false")
680+
# message("----sik---- DB: get in _libraries is false")
681+
message("---check_fortran_libraries (call)-- ---- sik [begin] --- CHECK_FUNCTION_EXISTS --")
682+
message("---check_fortran_libraries (call)-- _LIBRARIES: ${_LIBRARIES} ")
683+
message("---check_fortran_libraries (call)-- ${_LIBRARIES} : ${${_LIBRARIES}} ")
684+
message("---check_fortran_libraries (call)-- BLAS_mkl_SEARCH_SYMBOL : ${BLAS_mkl_SEARCH_SYMBOL} ")
685+
message("---check_fortran_libraries (call)-- SEARCH_LIBS : ${SEARCH_LIBS} ")
686+
message("---check_fortran_libraries (call)-- CMAKE_THREAD_LIBS_INIT : ${CMAKE_THREAD_LIBS_INIT} ")
687+
message("---check_fortran_libraries (call)-- LM : ${LM} ")
688+
message("---check_fortran_libraries (call)-- ---- sik [end] --- CHECK_FUNCTION_EXISTS --")
663689
check_fortran_libraries(
664690
${_LIBRARIES}
665691
BLAS
@@ -668,8 +694,8 @@ if (BLA_VENDOR MATCHES "Intel" OR BLA_VENDOR STREQUAL "All")
668694
"${SEARCH_LIBS}"
669695
"${CMAKE_THREAD_LIBS_INIT};${LM}"
670696
)
671-
message("----sik---- DB: libraries: ${_LIBRARIES} is ${${_LIBRARIES}}")
672-
message("----sik---- DB: it : ${IT} ")
697+
# message("----sik---- DB: libraries: ${_LIBRARIES} is ${${_LIBRARIES}}")
698+
# message("----sik---- DB: it : ${IT} ")
673699
endif ()
674700
endforeach ()
675701

0 commit comments

Comments
 (0)