[cmake-developers] [CMake] Path to vc_redist
Roman Wüger
roman.wueger at gmx.at
Tue Sep 5 03:44:49 EDT 2017
Thank you Robert,
I came up with the following, maybe someone has a better idea:
if (WIN32)
if(CMAKE_SIZEOF_VOID_P EQUAL 8) # 64-bit
set(REDIST_ARCH x64)
else()
set(REDIST_ARCH x86)
endif()
set(REDIST_FILE vcredist_${REDIST_ARCH}.exe)
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
include(InstallRequiredSystemLibraries)
# Check if the list contains minimum one element, to get the path from
list(LENGTHCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS libsCount)
if (libsCount GREATER 0)
list(GET CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS 0 _path)
get_filename_component(_path ${_path} DIRECTORY)
get_filename_component(_path ${_path}/../../ ABSOLUTE)
if (EXISTS "${_path}/${REDIST_FILE}") # VS 2017
set(REDIST_FILE ${_path}/${REDIST_FILE})
else()
get_filename_component(_path ${_path}/1033ABSOLUTE)
set(REDIST_FILE ${_path}/${REDIST_FILE})
endif()
install(PROGRAMS ${_path}/${REDIST_FILE})
endif()
endif()
Regards
Roman
> Am 04.09.2017 um 15:20 schrieb Robert Maynard <robert.maynard at kitware.com>:
>
> You can use the InstallRequiredSystemLibraries to do this. Since it sounds like you don't want all the libraries installed, use CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP and than deduce the path of vc_redist.exe from the value(s) in CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS.
>
>> On Mon, Sep 4, 2017 at 3:01 AM, Roman Wüger <roman.wueger at gmx.at> wrote:
>> Hello,
>>
>> is there already an existing function to get the vc_redist.exe for the current generator?
>>
>> Regards
>> Roman
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://public.kitware.com/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20170905/006c17eb/attachment.html>
More information about the cmake-developers
mailing list