Monday, May 9, 2022

[SOLVED] How to set xcode debugger working directory with CMake

Issue

I searched for an equivalent of VS_DEBUGGER_WORKING_DIRECTORY for xcode in cmake documentation, but I couldn't find one. If it indeed doesn't exist, how I can use existing cmake functions to achieve setting the working directory to what I want while running the xcode debugger for my c++ application?


Solution

Just in case anyone is interested, I figured it out. It's

set_target_properties(<your-target> PROPERTIES 
                      XCODE_GENERATE_SCHEME TRUE
                      XCODE_SCHEME_WORKING_DIRECTORY <desired-directory>)


Answered By - user3667089
Answer Checked By - Willingham (WPSolving Volunteer)