Finding and launching plugin host with CMake find_program

Im getting started on using CMake and Im wondering if anybody managed to find a way to automatically find the host executables and automatically set the post build command with cmake, so you dont have to do it manually every time after rebuilding.
I tried



# launch FL when on windows, Reaper when on mac
if(WIN32)
    find_program(FLSTUDIO_EXE FL64.exe)
    if(EXISTS ${FLSTUDIO})
        add_custom_command(
            TARGET "${PROJECT_NAME}"
            POST_BUILD
            COMMAND ${FLSTUDIO_PATH})
    endif()
elseif(UNIX)
    find_program(REAPER Reaper)
    add_custom_command(
        TARGET "${PROJECT_NAME}"
        POST_BUILD
        COMMAND ${REAPER})
endif()

If you use Xcode, you can do
set_target_properties(${PROJECT_NAME} PROPERTIES XCODE_SCHEME_EXECUTABLE ${REAPER})

1 Like