简体   繁体   中英

CMake in CLion, invoke remote build instead of building localy

I want to achieve following, I have a cmake configuration in CLion, include paths, source files and executable. The source cannot be built locally, so I have to invoke remote build, for example using SSH. The question is how do I invoke Build command, but I dont have add_executable , so nothing built locally? I tried to add add_custom_command and remove the add_executable . However it didnt make the trick.
Short version of my CMakeList.txt '

cmake_minimum_required(VERSION 3.9)
project(boo)

set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
set(CMAKE_CXX_STANDARD 14)
include_directories(lib/include lib/include/control lib/include/ext lib/include/infra lib/include/boo)
file(GLOB_RECURSE BOO_FILES
        "*.h"
        "*.cpp"
        "*.thrift"
        "*.json"
        )

add_executable(boo ${BOO_FILES})

add_custom_command(TARGET boo PRE_BUILD COMMAND "some command here")

I think it is about add_custom_target but I cant figure out how to put all of it together

Ok, figured it out just leave the add_executable as is and add additional targets to build
Something like

# just run my remote make
add_custom_command(OUTPUT BooMake COMMAND your remote make command goes here WORKING_DIRECTORY "c:/Program Files/PuTTY/")
add_custom_target(BooBuild ALL DEPENDS BooMake)

Additional configuration BooBuild will appear in CLion, just run it
Limitation, error messages are not clickable, gotta figure it out

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM