没有运行的CLion构建

时间:2017-04-08 09:52:00

标签: c++ cmake cross-compiling clion run-configuration

我在CLion中有一个C ++项目,我想用cmake进行交叉编译。 Cmake本身完全运行,而arm-linux编译的二进制文件运行得很好。但是现在我希望有一个运行配置来执行此操作但是Clion不提供此功能而不尝试运行抛出错误的应用程序

11:31   Error running Build: Cannot run program "D:\Data\projects\smart-home\cmake-build-debug\smart-home-server" (in directory "D:\Data\projects\smart-home\cmake-build-debug"): CreateProcess error=193, %1 ist keine zulässige Win32-Anwendung

这是我的CMakeList.txt

SET(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_BUILD_TYPE Debug)

set(CMAKE_SYSROOT D:/Programme/SysGCC/arm-linux-gnueabihf/sysroot)
SET(CMAKE_FIND_ROOT_PATH D:/Programme/SysGCC/arm-linux-gnueabihf/sysroot)
SET(CMAKE_C_COMPILER D:/Programme/SysGCC/bin/arm-linux-gnueabihf-gcc-4.9.exe)
SET(CMAKE_CXX_COMPILER D:/Programme/SysGCC/bin/arm-linux-gnueabihf-g++.exe)
SET(make D:/Programme/SysGCC/bin/make.exe)

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(libs ${CMAKE_SOURCE_DIR}/lib)

cmake_minimum_required(VERSION 3.0)
project(smart-home-server)

execute_process(COMMAND mysql_config --cflags OUTPUT_VARIABLE MYSQL_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND mysql_config --libs OUTPUT_VARIABLE MYSQL_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)

include_directories(lib/usr/include/mysql)
link_libraries(${libs}/libmysqlclient.so ${libs}/libwiringPi.so)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb -g2 -std=gnu++11 -pthread")

set(SOURCE_FILES
        rfm69/rfm69.cpp
        rfm69/rfm69.h
        rfm69/rfm69registers.h
        rfm69/RfmHandler.cpp
        rfm69/RfmHandler.h
        tcp/Client.cpp
        tcp/Client.h
        tcp/Opcodes.h
        tcp/Packet.h
        tcp/PacketHandler.cpp
        tcp/PacketHandler.h
        tcp/PacketReader.h
        tcp/PacketWriter.h
        tcp/Server.cpp
        tcp/Server.h
        controls/Controls.h
        json.hpp
        main.cpp
        MySql.cpp
        MySql.h
        Pilight.cpp
        Pilight.h
        README.md
        Singleton.h
        Util.h
        controls/Control.h
        controls/Elro800.h
)

include_directories(.)
include_directories(rfm69)
include_directories(tcp)

add_executable(smart-home-server ${SOURCE_FILES})

这是我的CLion运行配置

<configuration default="false" name="Build" type="CMakeRunConfiguration" factoryName="Application" WORKING_DIR="" PASS_PARENT_ENVS_2="true" CONFIG_NAME="Debug" RUN_TARGET_PROJECT_NAME="smart-home-server" RUN_TARGET_NAME="smart-home-server" EXPLICIT_BUILD_TARGET_NAME="all">
    <envs />
    <method />
</configuration>

有谁知道如何创建一个只运行cmake的运行配置?

提前谢谢

1 个答案:

答案 0 :(得分:3)

使用“构建”操作代替“运行”。

]