diff --git a/docs/installation.rst b/docs/installation.rst index 2ef12d8d41..d8ecf99773 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -342,6 +342,7 @@ the path to the source directory. saving default use of symbolic links for test files. Useful if the build is on a separate filesystem from the source, as required on some HPC systems. + ENABLE_PPCONVERT ON/OFF. Enable the ppconvert tool. If requirements are met, it is ON by default. - BLAS/LAPACK related diff --git a/src/QMCTools/ppconvert/CMakeLists.txt b/src/QMCTools/ppconvert/CMakeLists.txt index 37a7c018a4..9c751e6769 100644 --- a/src/QMCTools/ppconvert/CMakeLists.txt +++ b/src/QMCTools/ppconvert/CMakeLists.txt @@ -11,10 +11,14 @@ endif() string(REPLACE "-ffast-math" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) -# check if std::isnan works or not -# this check may fail when cross-compiling even if std::isnan actually functions properly. -include(CheckCXXSourceRuns) -check_cxx_source_runs( +if(CMAKE_CROSSCOMPILING) + message(STATUS "Cannot run std::isnan tests when cross compiling. Setting ISNAN_WORKS to FALSE.") + set(ISNAN_WORKS FALSE) +else() + # check if std::isnan works or not + # this check may fail when cross-compiling even if std::isnan actually functions properly. + include(CheckCXXSourceRuns) + check_cxx_source_runs( " #include int main() @@ -24,13 +28,16 @@ int main() return 1; } " -ISNAN_WORKS) + ISNAN_WORKS) +endif() + +option(ENABLE_PPCONVERT "Enable ppconvert" ${ISNAN_WORKS}) # ppconvert only works when std::isnan works. -if(ISNAN_WORKS) - message(STATUS "ppconvert enabled. std:isnan support check passed.") +if(ENABLE_PPCONVERT) + message(STATUS "ppconvert enabled.") add_subdirectory(src) add_subdirectory(test) else() - message(STATUS "ppconvert disabled. std:isnan support check failed.") + message(STATUS "ppconvert disabled.") endif()