Commit 650926b1 authored by Michael Gloff's avatar Michael Gloff

Fix the CMakeLists.txt

Signed-off-by: Michael Gloff's avatarMichael Gloff <mgloff@emacinc.com>
parent 5cf9e47c
if(EXISTS "/etc/emac/toolchain-selector.cmake")
include(/etc/emac/toolchain-selector.cmake)
if(EXISTS "$ENV{HOME}/EMAC-SDK/example-projects/toolchain-selector.cmake")
include($ENV{HOME}/EMAC-SDK/example-projects/toolchain-selector.cmake)
else()
MESSAGE(FATAL_ERROR "ERROR: Toolchain selection file could not be found at /etc/emac/toolchain-selector.cmake")
MESSAGE(FATAL_ERROR "ERROR: Toolchain selection could not be found at $ENV{HOME}/EMAC-SDK/example-projects/toolchain-selector.cmake")
endif()
cmake_minimum_required(VERSION 2.8)
project (timer)
project (xenomai_timer)
set(XENO_BASE "${CMAKE_FIND_ROOT_PATH}/usr")
set(XENOMAI_CONFIG "${XENO_BASE}/bin/xeno-config")
set(ENV{DESTDIR} "${CMAKE_FIND_ROOT_PATH}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -MMD -g")
execute_process(COMMAND ${XENOMAI_CONFIG} --posix --alchemy --cflags OUTPUT_VARIABLE XENOMAI_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND ${XENOMAI_CONFIG} --posix --alchemy --ldflags OUTPUT_VARIABLE XENOMAI_LDFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${XENO_BASE}/include/xenomai/cobalt -I${XENO_BASE}/include/xenomai -D_GNU_SOURCE -D_REENTRANT -D__COBALT__ -I${XENO_BASE}/include/xenomai/alchemy")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -MMD -g")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${XENOMAI_CFLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "-lalchemy -lcopperplate ${XENO_BASE}/lib/xenomai/bootstrap.o -Wl,--wrap=main -Wl,--dynamic-list=${XENO_BASE}/lib/dynlist.ld -L${XENO_BASE}/lib -lcobalt -lpthread -lrt")
set(CMAKE_EXE_LINKER_FLAGS "--sysroot=${CMAKE_FIND_ROOT_PATH} ${XENOMAI_LDFLAGS}")
include_directories(${XENO_BASE}/include ${XENO_BASE}/include/cobalt)
include_directories(${XENO_BASE}/include/xenomai ${XENO_BASE}/include/xenomai/cobalt)
link_directories(${XENO_BASE}/lib)
add_executable(timer timer.c)
add_executable(xenomai_timer timer.c)
add_definitions(-D_GNU_SOURCE -D_REENTRANT -D__XENO__ -DNO_GPL)
target_link_libraries(timer pthread rt alchemy copperplate cobalt)
target_link_libraries(xenomai_timer pthread rt alchemy copperplate cobalt)
file(WRITE "${CMAKE_SOURCE_DIR}/QtCreatorDeployment.txt" "${REMOTE}")
INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/xenomai_timer DESTINATION share/qt-creator-examples)
INSTALL(TARGETS xenomai_timer RUNTIME DESTINATION bin)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment