@@ -97,6 +97,22 @@ if(Boost_FOUND)
97
97
add_definitions (-DUSE_BOOST)
98
98
endif ()
99
99
100
+ # NOTE: After updating cmake_minimum_required to 3.5,
101
+ # if we call check_function_exists() after set(CMAKE_EXE_LINKER_FLAGS), it returns function not found
102
+ # So, I moved this step upward to avoid the compilation errors due to not-found functions
103
+ ##################################################################
104
+ # check existence of a few basic functions
105
+ ##################################################################
106
+ include (${CMAKE_ROOT} /Modules/CheckFunctionExists.cmake)
107
+ check_function_exists (gettimeofday HAVE_GETTIMEOFDAY)
108
+ check_function_exists (getrusage HAVE_GETRUSAGE)
109
+ check_function_exists (GlobalMemoryStatusEx HAVE_GLOBALMEMORYSTATUSEX)
110
+ check_function_exists (strndup HAVE_STRNDUP)
111
+ check_function_exists (strtok_r HAVE_STRTOK_R)
112
+ include (CheckIncludeFile)
113
+ CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTDH)
114
+ find_package (Backtrace)
115
+
100
116
# The version number.
101
117
set (iqtree_VERSION_MAJOR 2)
102
118
set (iqtree_VERSION_MINOR 4)
@@ -672,19 +688,6 @@ elseif (CLANG AND NOT CLANG_UNDER_VS)
672
688
set (CMAKE_C_FLAGS_MEM "-g -O1" )
673
689
endif ()
674
690
675
- ##################################################################
676
- # check existence of a few basic functions
677
- ##################################################################
678
- include (${CMAKE_ROOT} /Modules/CheckFunctionExists.cmake)
679
- check_function_exists (gettimeofday HAVE_GETTIMEOFDAY)
680
- check_function_exists (getrusage HAVE_GETRUSAGE)
681
- check_function_exists (GlobalMemoryStatusEx HAVE_GLOBALMEMORYSTATUSEX)
682
- check_function_exists (strndup HAVE_STRNDUP)
683
- check_function_exists (strtok_r HAVE_STRTOK_R)
684
- include (CheckIncludeFile)
685
- CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTDH)
686
- find_package (Backtrace)
687
-
688
691
# configure a header file to pass some of the CMake settings
689
692
# to the source code
690
693
configure_file (
0 commit comments