1cmake_minimum_required(VERSION 3.13 FATAL_ERROR) 2 3project(libs LANGUAGES C) 4 5if($ENV{ENABLE_64}) 6 message(STATUS "Building for 64bit") 7else() 8 add_compile_options(-m32) 9 add_link_options(-m32) 10 message(STATUS "Building for 32bit") 11endif() 12message(STATUS "Using toolchain file: ${CMAKE_TOOLCHAIN_FILE}.") 13 14get_filename_component( 15 externals ${CMAKE_CURRENT_SOURCE_DIR}/.. ABSOLUTE) 16add_subdirectory(${externals}/threadx threadx) 17target_compile_options(threadx PRIVATE -DTX_ENABLE_EVENT_TRACE) 18if(NOT DEFINED ENV{ENABLE_IDLE}) 19 target_compile_options(threadx PRIVATE -DTX_LINUX_NO_IDLE_ENABLE) 20endif() 21 22foreach(lib threadx) 23 get_target_property(dirs ${lib} INCLUDE_DIRECTORIES) 24 execute_process(COMMAND mkdir -p ${CMAKE_BINARY_DIR}/inc) 25 foreach(dir ${dirs}) 26 file(GLOB header_files ${dir}/*.h) 27 foreach(header_file ${header_files}) 28 execute_process(COMMAND ln -sf ${header_file} ${CMAKE_BINARY_DIR}/inc) 29 endforeach() 30 endforeach() 31endforeach() 32