ext4_config: set CONFIG_HAVE_OWN_ERRNO default value to 0
[lwext4.git] / CMakeLists.txt
1 project(lwext4 C)
2 cmake_minimum_required(VERSION 2.8)
3
4
5 include_directories(lwext4)
6 include_directories(blockdev/filedev)
7 include_directories(blockdev/filedev_win)
8
9 set(BLOCKDEV_TYPE  none)
10
11 add_definitions(-DVERSION="${VERSION}")
12
13 #Examples
14 if    (CMAKE_SYSTEM_PROCESSOR STREQUAL  cortex-m0)
15     #...
16 elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL  cortex-m3)
17     #...
18 elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL  arm-sim)
19     #...
20 elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL  cortex-m4)
21     #...
22 elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL  bf518)
23     #...
24 elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL  avrxmega7)
25     add_definitions(-DCONFIG_HAVE_OWN_ERRNO=1)
26 elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL  msp430g2210)
27     add_definitions(-DCONFIG_DEBUG_PRINTF=0)
28     add_definitions(-DCONFIG_DEBUG_ASSERT=0)
29     #...
30 elseif(LIB_ONLY)
31     add_definitions(-DCONFIG_DEBUG_PRINTF=0)
32     add_definitions(-DCONFIG_DEBUG_ASSERT=0)
33     add_definitions(-DCONFIG_HAVE_OWN_OFLAGS=1)
34     add_definitions(-DCONFIG_HAVE_OWN_ERRNO=0)
35     add_definitions(-DCONFIG_BLOCK_DEV_CACHE_SIZE=16)
36 else()
37     #Generic example target
38     set(BLOCKDEV_TYPE  linux)
39     add_definitions(-DCONFIG_HAVE_OWN_OFLAGS=0)
40     add_definitions(-DCONFIG_HAVE_OWN_ERRNO=0)
41     add_definitions(-DCONFIG_HAVE_OWN_ASSERT=0)
42     add_definitions(-DCONFIG_BLOCK_DEV_CACHE_SIZE=16)
43     add_subdirectory(fs_test)
44 endif()
45
46 add_subdirectory(blockdev)
47
48 #Library build
49 add_subdirectory(lwext4)
50 #Detect all possible warnings for lwext4 target
51 if (NOT CMAKE_COMPILER_IS_GNUCC)
52     set_target_properties(lwext4 PROPERTIES COMPILE_FLAGS "")
53 else()
54     set_target_properties(lwext4 PROPERTIES COMPILE_FLAGS "-Wall -Wextra -pedantic")
55 endif()
56
57 #DISTRIBUTION
58 set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
59 set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
60 set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
61 set(CPACK_SOURCE_GENERATOR "TBZ2")
62 set(CPACK_SOURCE_PACKAGE_FILE_NAME
63   "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
64 set(CPACK_SOURCE_IGNORE_FILES
65 "/build" ".git")
66 include(CPack)
67
68
69 add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)