conan-io / docs

conan.io reStructuredText documentation
http://docs.conan.io
MIT License
104 stars 346 forks source link

Documentation for CONAN_RUNTIME_LIB_DIRS seems incorrect #3775

Open Todiq opened 2 weeks ago

Todiq commented 2 weeks ago

Hello!

I was unable to create a minimal reproducible case that I could have posted in the conan repo issues.

Following https://docs.conan.io/2/reference/tools/cmake/cmaketoolchain.html#conan-runtime-lib-dirs kept leading me to the following error:

Running cmake --install .\dbconnectivity\build\windows-msvc-194-x86_64\ --prefix Release/:

-- Install configuration: "Release"
-- Installing: D://Release/lib/cwdbc.lib
-- Installing: D://Release/bin/cwdbc.dll
CMake Error at bconnectivity/build/windows-msvc-194-x86_64/cmake_install.cmake:75 (file): <-- we can observe a syntax error here as well: bconnectivity instead of dbconnectivity
  file Could not resolve runtime dependencies:

    HvsiFileTrust.dll

I managed to fix it by replacing [[.*/system32/.*\.dll]] with [=[.*system32\/.*\.dll]=]. I found the solution here: https://discourse.cmake.org/t/control-what-is-installed-packaged/3778/9.

I think we could even go as far as using these regexes. It works flawlessly for me on Windows but I'll let you test it further:

file(GET_RUNTIME_DEPENDENCIES my_app_deps
        PRE_EXCLUDE_REGEXES
            [=[api-ms-]=] # VC Redistibutable DLLs
            [=[ext-ms-]=] # Windows extension DLLs
            [[kernel32\.dll]] # Default in conan doc
            [[libc\.so\..*]] [[libgcc_s\.so\..*]] [[libm\.so\..*]] [[libstdc\+\+\.so\..*]] # Default in conan doc
        POST_EXCLUDE_REGEXES
            [=[.*system32\/.*\.dll]=] # Windows system DLLs
            [=[^\/(lib|usr\/lib|usr\/local\/lib)]=] # Unix system libraries
            DIRECTORIES ${CONAN_RUNTIME_LIB_DIRS}
    )

Would you mind having a look? Thanks in advance!