Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 13 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,25 @@
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)

# Declare the project with C only first so that CMake loads the toolchain file,
# which sets THREADX_ARCH and THREADX_TOOLCHAIN as normal variables. Checking
# those variables before project() would always fail because the toolchain is
# not sourced until the first project() call.
project(threadx LANGUAGES C)

if(NOT DEFINED THREADX_ARCH)
message(FATAL_ERROR "Error: THREADX_ARCH not defined")
endif()
if(NOT DEFINED THREADX_TOOLCHAIN)
message(FATAL_ERROR "Error: THREADX_TOOLCHAIN not defined")
endif()

# The Windows simulation ports build cleanly without executable try-compiles.
if((THREADX_ARCH STREQUAL "win32") OR (THREADX_ARCH STREQUAL "win64"))
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
endif()

# Set up the project. The Windows simulation ports do not use assembly and
# avoiding ASM language enablement keeps MSVC configuration on the CLI path
# deterministic.
if((THREADX_ARCH STREQUAL "win32") OR (THREADX_ARCH STREQUAL "win64"))
project(threadx
LANGUAGES C
)
else()
project(threadx
LANGUAGES C ASM
)
# The Windows simulation ports do not use assembly. All other ports require
# it. enable_language() is called here rather than in project() above so that
# the ASM toolchain is only activated when we know the target actually needs it.
# Note: CMAKE_TRY_COMPILE_TARGET_TYPE is already set to STATIC_LIBRARY by
# every toolchain file in cmake/, so it does not need to be repeated here.
if(NOT ((THREADX_ARCH STREQUAL "win32") OR (THREADX_ARCH STREQUAL "win64")))
enable_language(ASM)
endif()

option(THREADX_SMP "Build ThreadX SMP version" OFF)
Expand Down