-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathCMakeLists.txt
68 lines (59 loc) · 2.01 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
cmake_minimum_required (VERSION 2.6)
set(CMAKE_USER_MAKE_RULES_OVERRIDE
${CMAKE_CURRENT_SOURCE_DIR}/c_flag_overrides.cmake)
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX
${CMAKE_CURRENT_SOURCE_DIR}/cxx_flag_overrides.cmake)
# Maps to a solution file (Tutorial.sln). The solution will
# have all targets (exe, lib, dll) as projects (.vcproj)
project (PeachyUSB)
# Turn on the ability to create folders to organize projects (.vcproj)
# It creates "CMakePredefinedTargets" folder by default and adds CMake
# defined projects like INSTALL.vcproj and ZERO_CHECK.vcproj
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
# Set compiler flags and options.
# Here it is setting the Visual Studio warning level to 4
# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
# Command to output information to the console
# Useful for displaying errors, warnings, and debugging
message ("cxx Flags: " ${CMAKE_CXX_FLAGS})
set(EXTRA_LIBS "")
if(WIN32)
include_directories("deps")
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
find_library(LIBUSB_LIBRARY libusb-1.0 deps/win64)
else(CMAKE_SIZEOF_VOID_P EQUAL 8)
find_library(LIBUSB_LIBRARY libusb-1.0 deps/win32)
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
elseif(APPLE)
set(CMAKE_CXX_FLAGS "-std=c++11")
include_directories("/usr/include/libusb-1.0" "/usr/local/include/libusb-1.0")
find_library(LIBUSB_LIBRARY
NAMES
libusb-1.0.a libusb.a
PATHS
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/local/lib
/opt/local/lib
/sw/lib
)
find_library(COREFOUNDATION_LIBRARY CoreFoundation)
find_library(IOKIT_LIBRARY IOKit)
set(EXTRA_LIBS ${EXTRA_LIBS} ${COREFOUNDATION_LIBRARY} ${IOKIT_LIBRARY} objc)
elseif(UNIX)
set(CMAKE_CXX_FLAGS "-std=c++11")
include_directories("/usr/include/libusb-1.0" "/usr/local/include/libusb-1.0")
find_library(LIBUSB_LIBRARY
NAMES
usb-1.0 usb
PATHS
/usr/lib
/usr/lib/x86_64-linux-gnu
/usr/local/lib
/opt/local/lib
/sw/lib
)
endif(WIN32)
include_directories(inc)
# Sub-directories where more CMakeLists.txt exist
add_subdirectory(src)