diff --git a/CMakeLists.txt b/CMakeLists.txt index 2570a4cad..759a95f97 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,7 +55,7 @@ cmake_dependent_option(ENABLE_ASSISTANT "Turn on assistant compiling." YES "ENAB list(APPEND CMAKE_MODULE_PATH ${CMAKE_PREFIX_PATH}/share/cmake/Modules) include(CheckIncludeFile) -include(CheckLibraryExists) +include(CheckSymbolExists) if(MSVC) list(APPEND CMAKE_REQUIRED_INCLUDES ${CMAKE_PREFIX_PATH}/include/MSVC) @@ -67,8 +67,12 @@ find_package(XML2 REQUIRED) if(ENABLE_UNIT_TESTS) find_package(CUnit) if(CUNIT_FOUND) - check_library_exists("cunit" "CU_get_suite" "" HAVE_CU_GET_SUITE) - check_library_exists("cunit" "CU_curses_run_tests" "" HAVE_CU_CURSES) + cmake_push_check_state(RESET) + list(APPEND CMAKE_REQUIRED_INCLUDES ${CUNIT_INCLUDE_DIRS}) + list(APPEND CMAKE_REQUIRED_LIBRARIES ${CUNIT_LIBRARIES}) + check_symbol_exists("CU_get_suite" "CUnit/CUnit.h" HAVE_CU_GET_SUITE) + check_symbol_exists("CU_curses_run_tests" "CUnit/CUnit.h" HAVE_CU_CURSES) + cmake_pop_check_state() else() message(WARNING "Could not find the cunit library!") set(ENABLE_UNIT_TESTS OFF CACHE BOOL "Enable compilation of unit tests." FORCE)