Skip to content

Commit

Permalink
added an option to use the sources instead of the static lib
Browse files Browse the repository at this point in the history
  • Loading branch information
ulrichard committed Jan 19, 2012
1 parent ef6bb2d commit edb9780
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions examples/RobotArmLib/arexx_robot_arm_crosscompile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ IF(NOT CMAKE_OBJCOPY)
ERROR()
ENDIF()

# if you don't trust the static lib, maybe because you have another microprocessor, you can instead compile the lib
# sources directly in your prroject. Another reason to do so is if you mix c and c++ (don't know why that is a problem yet)
OPTION(USE_ARM_LIB_SRC "Compile the sources of the robot arm lib for every target instead of using the static lib" ON)

MACRO(ADD_ROBOT_ARM_EXECUTABLE ROBOT_ARM_EXE_NAME)
INCLUDE_DIRECTORIES(${ArexxRobotArm_INCLUDE_DIRS})

ADD_EXECUTABLE(${ROBOT_ARM_EXE_NAME}.elf
SET(SourceFiles
${ARGV1}
${ARGV2}
${ARGV3}
Expand All @@ -44,14 +48,17 @@ MACRO(ADD_ROBOT_ARM_EXECUTABLE ROBOT_ARM_EXE_NAME)
${ARGV7}
${ARGV8}
${ARGV9}

# if you don't trust the static lib, maybe because you have another microprocessor, you can instead compile the lib sources directly in your prroject:
# ${ArexxRobotArm_SOURCES}
)

IF(USE_ARM_LIB_SRC)
SET(SourceFiles ${SourceFiles} ${ArexxRobotArm_SOURCES})
ENDIF()

TARGET_LINK_LIBRARIES(${ROBOT_ARM_EXE_NAME}.elf
${ArexxRobotArm_LIBRARY}
)
ADD_EXECUTABLE(${ROBOT_ARM_EXE_NAME}.elf ${SourceFiles})

IF(NOT USE_ARM_LIB_SRC)
TARGET_LINK_LIBRARIES(${ROBOT_ARM_EXE_NAME}.elf ${ArexxRobotArm_LIBRARY})
ENDIF()


ADD_CUSTOM_COMMAND(TARGET ${ROBOT_ARM_EXE_NAME}.elf POST_BUILD
Expand Down

0 comments on commit edb9780

Please sign in to comment.