Failing to set VS_DEBUGGER_* on target added via add_custom_target.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Failing to set VS_DEBUGGER_* on target added via add_custom_target.

Albrecht Fritzsche

Hi,

 

I – being new to CMake - somehow fail to set VS_DEBUGGER_* property values on a project added via add_custom_target(). The settings of those property values seem to be lost and not written to any .vcxproj file. Doing the same to a target added via add_executable() works on the other hand as expected, ie the debug property values show up correctly in the corresponding .vcxproj. (This is all tried with Visual Studio 2015.)

 

What is the proposed way to achieve the settings of the property values on a project added via add_custom_target()? What am I doing wrong?

 

_Details_ I have the helloWorld.cpp and CMakeLists.txt next to a subdirectory ext, containing both the test01.cpp and test01.exe. Ie

  CMakeLists.txt

  helloWorld.cpp

  ext/

      test01.cpp

      test01.exe

 

The CMake code in a nutshell:

 

add_executable(helloWorld helloWorld.cpp)

 

set(test_name "test01")

set(test_target "${test_name}_build")

add_custom_target(${test_target}

    #COMMAND ${CMAKE_COMMAND} -E env "PATH=${BUILD_DRIVER_NVMAKE_DIRECTORY};$ENV{PATH}" nvmake ...

    COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/ext/${test_name}.exe" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>"

    SOURCES "${CMAKE_SOURCE_DIR}/ext/${test_name}.cpp"

)

set_property( TARGET ${test_target} PROPERTY FOLDER "nvmake tests" )

# from the following two set_property() calls only the first one has an effect in the generated .vcxproj files

set_property( TARGET helloWorld     PROPERTY VS_DEBUGGER_COMMAND "foo.exe" )

set_property( TARGET ${test_target} PROPERTY VS_DEBUGGER_COMMAND "foo.exe" )

 

 

I understand that using imported targets might be an even more appropriate solution for the problem at hand. But with imported targets, eg via add_executable(${test_target} IMPORTED), I fail to add those in a way that they show up as projects in Visual Studio. What is the recommended way for this approach?

 

Thanks for any hints,

Ali

PS The custom target ends up as a project of configuration type Utility – is there a way to change it to type Executable?


This email message is for the sole use of the intended recipient(s) and may contain confidential information.  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.


--

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