[cmake-developers] Strange behaviour with check_library_exists on Windows

Sergei Nikulov sergey.nikulov at gmail.com
Thu Jul 28 06:33:35 EDT 2016


Hello,

While verifying curl library build issue on Windows - I've discovered
some differences in check_library_exists behaviour for different
targets 64 vs 32 bits.

The problem as follows - check_library_exists find library symbol when
Win64 platform used, but not for default 32 bit.

Here the output for Win64 bit generation
-----------------------------------------
E:\WORK\github\cmake_issue_checklibraryexist\build.64>cmake ..
-G"Visual Studio 14 2015 Win64"
-- The C compiler identification is MSVC 19.0.24210.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft
Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft
Visual Studio 14.0/VC/bin/x86_amd64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Looking for CertFreeCertificateContext in crypt32;
-- Looking for CertFreeCertificateContext in crypt32; - found
crypt32 found
-- Configuring done
-- Generating done
-- Build files have been written to:
E:/WORK/github/cmake_issue_checklibraryexist/build.64
-----------------------------------------

Here the output for 32-bit generation
-----------------------------------------
E:\WORK\github\cmake_issue_checklibraryexist\build.32>cmake ..
-G"Visual Studio 14 2015"
-- The C compiler identification is MSVC 19.0.24210.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft
Visual Studio 14.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft
Visual Studio 14.0/VC/bin/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Looking for CertFreeCertificateContext in crypt32;
-- Looking for CertFreeCertificateContext in crypt32; - not found
crypt32 not found
-- Configuring done
-- Generating done
-- Build files have been written to:
E:/WORK/github/cmake_issue_checklibraryexist/build.32
-----------------------------------------

I've provided MVE on GitHub
https://github.com/snikulov/cmake_issue_checklibraryexist


Is this expected behavior our known issue?

CMake version is 3.6.0

Thank you.

-- 
Best Regards,
Sergei Nikulov


More information about the cmake-developers mailing list