I'm trying to compile 3.6.2 tag on Linux with the following cmake variables: -DDCMTK_ENABLE_CXX11=ON -DDCMTK_ENABLE_STL=ON. The error(s) I get when generating make are along the lines of:
Code: Select all
/tmp/dcmtk/config/tests/../math.cc:108:12: error: '::isinf' has not been
declared
return ::isinf( f );
I debugged the code that checks for function existence and the generated code is basically:
Code: Select all
//bunch of headers omitted
int main()
{
std::isnan;return 0;
}
/*
manually checking with gcc identifies the problem
CheckSymbolExists_std__isnan.cxx:29:11: error: statement cannot resolve address of overloaded function
std::isnan;return 0;
*/
Changing CMake/GenerateDCMTKConfigure.cmaketo checks to supply some kind of template argument appears to resolve the issue. CHECK_FUNCTIONWITHHEADER_EXISTS(std::isinf<double> "${HEADERS}" HAVE_PROTOTYPE_STD__ISINF) appear to solve the problem.
The patch:
Code: Select all
diff --git a/CMake/GenerateDCMTKConfigure.cmake b/CMake/GenerateDCMTKConfigure.cmake
index 19fb179..ab36c94 100755
--- a/CMake/GenerateDCMTKConfigure.cmake
+++ b/CMake/GenerateDCMTKConfigure.cmake
@@ -571,9 +571,9 @@ ENDIF(WIN32 AND NOT CYGWIN)
CHECK_FUNCTIONWITHHEADER_EXISTS(isinf "${HEADERS}" HAVE_PROTOTYPE_ISINF)
CHECK_FUNCTIONWITHHEADER_EXISTS(isnan "${HEADERS}" HAVE_PROTOTYPE_ISNAN)
CHECK_FUNCTIONWITHHEADER_EXISTS(finite "${HEADERS}" HAVE_PROTOTYPE_FINITE)
- CHECK_FUNCTIONWITHHEADER_EXISTS(std::isinf "${HEADERS}" HAVE_PROTOTYPE_STD__ISINF)
- CHECK_FUNCTIONWITHHEADER_EXISTS(std::isnan "${HEADERS}" HAVE_PROTOTYPE_STD__ISNAN)
- CHECK_FUNCTIONWITHHEADER_EXISTS(std::finite "${HEADERS}" HAVE_PROTOTYPE_STD__FINITE)
+ CHECK_FUNCTIONWITHHEADER_EXISTS(std::isinf<double> "${HEADERS}" HAVE_PROTOTYPE_STD__ISINF)
+ CHECK_FUNCTIONWITHHEADER_EXISTS(std::isnan<double> "${HEADERS}" HAVE_PROTOTYPE_STD__ISNAN)
+ CHECK_FUNCTIONWITHHEADER_EXISTS(std::finite<double> "${HEADERS}" HAVE_PROTOTYPE_STD__FINITE)
CHECK_FUNCTIONWITHHEADER_EXISTS(flock "${HEADERS}" HAVE_PROTOTYPE_FLOCK)
CHECK_FUNCTIONWITHHEADER_EXISTS(gethostbyname "${HEADERS}" HAVE_PROTOTYPE_GETHOSTBYNAME)
CHECK_FUNCTIONWITHHEADER_EXISTS(gethostbyname_r "${HEADERS}" HAVE_PROTOTYPE_GETHOSTBYNAME_R)
Code: Select all
diff --git a/CMake/CheckFunctionWithHeaderExists.cmake b/CMake/CheckFunctionWithHeaderExists.cmake
index 1b95ac4..86de035 100644
--- a/CMake/CheckFunctionWithHeaderExists.cmake
+++ b/CMake/CheckFunctionWithHeaderExists.cmake
@@ -23,13 +23,15 @@ MACRO(CHECK_FUNCTIONWITHHEADER_EXISTS SYMBOL FILES VARIABLE)
SET(CHECK_SYMBOL_EXISTS_CONTENT
"${CHECK_SYMBOL_EXISTS_CONTENT}\nint main()\n{\n${SYMBOL};return 0;\n}\n")
- FILE(WRITE ${CMAKE_BINARY_DIR}/CMakeTmp/CheckSymbolExists.cxx
+ STRING(REGEX REPLACE "[:<>()]" "_" SYMBOL_FILENAME_SANITIZED ${SYMBOL})
+
+ FILE(WRITE ${CMAKE_BINARY_DIR}/CMakeTmp/CheckSymbolExists_${SYMBOL_FILENAME_SANITIZED}.cxx
"${CHECK_SYMBOL_EXISTS_CONTENT}")
MESSAGE(STATUS "Looking for prototype of ${SYMBOL}")
TRY_COMPILE(${VARIABLE}
"${CMAKE_BINARY_DIR}"
- "${CMAKE_BINARY_DIR}/CMakeTmp/CheckSymbolExists.cxx"
+ "${CMAKE_BINARY_DIR}/CMakeTmp/CheckSymbolExists_${SYMBOL_FILENAME_SANITIZED}.cxx"
CMAKE_FLAGS
-DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_SYMBOL_EXISTS_FLAGS}
"-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}"
@@ -50,7 +52,7 @@ MACRO(CHECK_FUNCTIONWITHHEADER_EXISTS SYMBOL FILES VARIABLE)
FILE(APPEND "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log"
"Determining if the ${SYMBOL} "
"exist failed with the following output:\n"
- "${OUTPUT}\nFile ${CMAKE_BINARY_DIR}/CMakeTmp/CheckSymbolExists.cxx:\n"
+ "${OUTPUT}\nFile ${CMAKE_BINARY_DIR}/CMakeTmp/CheckSymbolExists_${SYMBOL_FILENAME_SANITIZED}.cxx:\n"
"${CHECK_SYMBOL_EXISTS_CONTENT}\n")
ENDIF(${VARIABLE})
ENDIF(NOT DEFINED "${VARIABLE}")
Thanks.