Skip to content

Commit e7a16cb

Browse files
committed
add can-run to native builds
1 parent 0a13974 commit e7a16cb

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

all/conanfile.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,9 @@ def _configure_native_gcc(self):
320320
self.conf_info.define(
321321
"tools.cmake.cmaketoolchain:system_name", "Windows")
322322

323+
# Tell CMake that native binaries can run on this machine
324+
self.conf_info.define("tools.build.cross_building:can_run", True)
325+
323326
# CMake extra variables for native GCC
324327
self.conf_info.define("tools.cmake.cmaketoolchain:extra_variables", {
325328
"CMAKE_C_COMPILER": "gcc",

demos/cpp/CMakeLists.txt

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ project(demo LANGUAGES CXX)
77

88
add_executable(demo main.cpp)
99

10-
if(NOT ${CMAKE_CROSSCOMPILING})
11-
message(STATUS "🚀 Will launch demo after building")
12-
add_custom_target(run_demo ALL DEPENDS demo COMMAND demo)
13-
else()
10+
if(${CMAKE_CROSSCOMPILING})
1411
message(STATUS "⏭️ Binary is not native, skipping build")
15-
endif(NOT ${CMAKE_CROSSCOMPILING})
12+
else()
13+
message(STATUS "🚀 Will launch demo after building")
14+
endif(${CMAKE_CROSSCOMPILING})
15+
16+
add_custom_target(run_demo ALL DEPENDS demo COMMAND ${CMAKE_BINARY_DIR}/demo)
1617

1718
add_custom_target(copy_compile_commands ALL
1819
COMMAND ${CMAKE_COMMAND} -E copy_if_different

0 commit comments

Comments
 (0)