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
49 if( ${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
50 # Find libusb (not 1.0)
51 find_package( LibUSB 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 "Windows" )
64 message( AUTHOR_WARNING "Not Tested...")
67 set( DEFINES -s -DUSE_WIN32 )
70 set( LIBS hid setupapi )
73 elseif( ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
74 message( AUTHOR_WARNING "Not Tested...")
76 # Defines - XXX What is SDK?
77 set( DEFINES -DUSE_APPLE_IOKIT -isysroot ${SDK} -Wl,-syslibroot,${SDK} -framework IOKit -framework CoreFoundation )
79 #| BSD - NetBSD and OpenBSD
80 elseif( ${CMAKE_SYSTEM_NAME} MATCHES "BSD" )
81 message( AUTHOR_WARNING "Not Tested...")
84 set( DEFINES -s -DUSE_UHID )
94 set( CFLAGS -O2 -Wall )
96 add_definitions( ${CFLAGS} ${DEFINES} )
105 include_directories( ${INCLUDE_DIRS} )
113 #| Create the executable
114 add_executable( ${TARGET} ${SRCS} )
117 target_link_libraries( ${TARGET} ${LIBS} )