Changeset View
Changeset View
Standalone View
Standalone View
cmake/modules/NativeExecutable.cmake
# Allow to easily build native executable. | # Allow to easily build native executable. | ||||
# Useful for cross compilation. | # Useful for cross compilation. | ||||
if(NOT DEFINED __IS_NATIVE_BUILD) | |||||
# Check if we are in a native build or not. | # Check if we are in a native build or not. | ||||
set(__IS_NATIVE_BUILD 0 CACHE INTERNAL "Indicate if this is a native build") | set(__IS_NATIVE_BUILD 0 CACHE INTERNAL "Indicate if this is a native build") | ||||
endif() | |||||
if(__IS_NATIVE_BUILD AND CMAKE_CROSSCOMPILING) | if(__IS_NATIVE_BUILD AND CMAKE_CROSSCOMPILING) | ||||
message(FATAL_ERROR "A native build cannot be cross compiled") | message(FATAL_ERROR "A native build cannot be cross compiled") | ||||
endif() | endif() | ||||
# If we are cross compiling, create a directory for native build. | # If we are cross compiling, create a directory for native build. | ||||
set(NATIVE_BUILD_DIR "${CMAKE_BINARY_DIR}/native") | set(NATIVE_BUILD_DIR "${CMAKE_BINARY_DIR}/native") | ||||
set(NATIVE_BINARY_DIR "${NATIVE_BUILD_DIR}/bin") | set(NATIVE_BINARY_DIR "${NATIVE_BUILD_DIR}/bin") | ||||
set(NATIVE_BUILD_TARGET "${NATIVE_BUILD_DIR}/CMakeCache.txt") | set(NATIVE_BUILD_TARGET "${NATIVE_BUILD_DIR}/CMakeCache.txt") | ||||
▲ Show 20 Lines • Show All 50 Lines • Show Last 20 Lines |