Index: openmp/runtime/cmake/LibompHandleFlags.cmake =================================================================== --- openmp/runtime/cmake/LibompHandleFlags.cmake +++ openmp/runtime/cmake/LibompHandleFlags.cmake @@ -127,7 +127,7 @@ libomp_append(libflags_local -lirc_pic LIBOMP_HAVE_IRC_PIC_LIBRARY) endif() if(MINGW) - libomp_append(libflags_local -lpsapi LIBOMP_HAVE_LIBPSAPI) + libomp_append(libflags_local -lpsapi LIBOMP_HAVE_PSAPI) endif() if(LIBOMP_HAVE_SHM_OPEN_WITH_LRT) libomp_append(libflags_local -lrt) Index: openmp/runtime/cmake/config-ix.cmake =================================================================== --- openmp/runtime/cmake/config-ix.cmake +++ openmp/runtime/cmake/config-ix.cmake @@ -278,11 +278,13 @@ check_c_source_compiles("__attribute__ ((weak)) int foo(int a) { return a*a; } int main(int argc, char** argv) { return foo(argc);}" LIBOMP_HAVE_WEAK_ATTRIBUTE) -check_include_files("windows.h;psapi.h" LIBOMP_HAVE_PSAPI_H) -check_library_exists(psapi EnumProcessModules "" LIBOMP_HAVE_LIBPSAPI) -if(LIBOMP_HAVE_PSAPI_H AND LIBOMP_HAVE_LIBPSAPI) - set(LIBOMP_HAVE_PSAPI TRUE) -endif() +set(CMAKE_REQUIRED_LIBRARIES psapi) +check_c_source_compiles("#include + #include + int main(int artc, char** argv) { + return EnumProcessModules(NULL, NULL, 0, NULL); + }" LIBOMP_HAVE_PSAPI) +set(CMAKE_REQUIRED_LIBRARIES) if(NOT LIBOMP_HAVE___BUILTIN_FRAME_ADDRESS) set(LIBOMP_HAVE_OMPT_SUPPORT FALSE) else()