1 ###| CMAKE teensy-loader-cli |###
4 # Written to replace the pjrc's kludey Makefiles
5 # (that require hand edits for different platforms)
7 # Released into the Public Domain
11 #| Windows / Cygwin Compatibility options
12 set( CMAKE_LEGACY_CYGWIN_WIN32 0 )
13 set( CMAKE_USE_RELATIVE_PATHS 1 )
22 project( teensy-loader-cli )
24 #| Target Name (output name)
25 set( TARGET teensy-loader-cli )
28 cmake_minimum_required( VERSION 2.8 )
46 list( APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR} ) # Use local find scripts
48 #| Linux/Windows - libusb
49 if( CMAKE_SYSTEM_NAME MATCHES "Linux" OR CMAKE_SYSTEM_NAME MATCHES "CYGWIN" )
50 # Find libusb (not 1.0)
51 find_package( LibUSB-1.0 REQUIRED )
54 set( DEFINES -s -DUSE_LIBUSB )
57 set( INCLUDE_DIRS ${LIBUSB_INCLUDE_DIRS} )
60 set( LIBS ${LIBUSB_LIBRARIES} )
63 elseif( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
64 message( AUTHOR_WARNING "Not Tested...")
66 # Defines - XXX What is SDK?
67 set( DEFINES -DUSE_APPLE_IOKIT -isysroot ${SDK} -Wl,-syslibroot,${SDK} -framework IOKit -framework CoreFoundation )
69 #| BSD - NetBSD and OpenBSD
70 elseif( CMAKE_SYSTEM_NAME MATCHES "BSD" )
71 message( AUTHOR_WARNING "Not Tested...")
74 set( DEFINES -s -DUSE_UHID )
77 message( FATAL_ERROR "${CMAKE_SYSTEM_NAME}: OS Not Recognized..." )
87 set( CFLAGS -O2 -Wall -std=gnu99 )
89 add_definitions( ${CFLAGS} ${DEFINES} )
98 include_directories( ${INCLUDE_DIRS} )
106 #| Create the executable
107 add_executable( ${TARGET} ${SRCS} )
110 target_link_libraries( ${TARGET} ${LIBS} )