mikewho
mikewho

Reputation: 145

Use CMake to set Debugging->Environment string for Visual Studio project

Is there a command in CMake to set the value in Visual Studio when you right click on a project, go to Properties, then Debugging->Environment.

I like to put a string like this in that value: PATH=C:/libs/vtk/bin/bin/$(Configuration);%PATH%

This allows me to maintain where DLLs are for a project on a project-by-project basis. Any help would be appreciated, thanks!

Upvotes: 0

Views: 982

Answers (1)

Jackson Wang
Jackson Wang

Reputation: 36

See Support VS_DEBUGGER_ENVIRONMENT in cmake projects. You need to add the following CMake code fragment in your project CMakeLists.txt

if(WIN32)
    set_target_properties(chebyshev_polynomials_demo 
        PROPERTIES VS_DEBUGGER_ENVIRONMENT "PATH=%PATH%;$<TARGET_FILE_DIR:Qt5::Core>;"
    )
endif()

Upvotes: 2

Related Questions