[CMake] Build and run an external project

Eric Noulard eric.noulard at gmail.com
Mon Dec 3 23:55:04 EST 2018


Did you check whether if
https://cmake.org/cmake/help/latest/command/include_external_msproject.html

wouldn't be better in your case?


Le mar. 4 déc. 2018 01:43, James Bigler <jamesbigler at gmail.com> a écrit :

> I have an external project that I would like to compile using their build
> system, and be able to set the VS_COMMAND to the result of the project so I
> can run it.
>
>       add_custom_target(${cmake_target}
>         COMMAND make mytarget ${BUILD_ARGS}
>         COMMAND ${CMAKE_COMMAND} -E copy_if_different
> ${PATH_TO_EXTERNAL}/mytarget.exe ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>
>         WORKING_DIRECTORY ${PATH_TO_EXTERNAL}
>         )
>       set_property( TARGET ${cmake_target} PROPERTY VS_DEBUGGER_COMMAND
> "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>/mytarget.exe" )
>
> The VS_DEBUGGER_COMMAND works for targets such as add_executable, but not
> for add_custom_target.
>
> Is there a way to get what I want?
>
> Note that this is part of a larger CMake project that builds most of the
> other stuff using CMake, but I have a few external projects that I would
> like as part of the main solution.
>
> Thanks,
> James
> --
>
> 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:
> https://cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20181204/309f692c/attachment.html>


More information about the CMake mailing list