2 cmake_minimum_required(VERSION 2.8)
5 include_directories(${PROJECT_BINARY_DIR}/include)
6 include_directories(blockdev/filedev)
7 include_directories(blockdev/filedev_win)
9 set(BLOCKDEV_TYPE none)
11 add_definitions(-DCONFIG_USE_DEFAULT_CONFIG=0)
12 add_definitions(-DVERSION="${VERSION}")
15 if (CMAKE_SYSTEM_PROCESSOR STREQUAL cortex-m0)
17 elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL cortex-m3)
18 add_definitions(-DCONFIG_UNALIGNED_ACCESS=1)
19 elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL arm-sim)
21 elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL cortex-m4)
22 add_definitions(-DCONFIG_UNALIGNED_ACCESS=1)
23 elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL bf518)
25 elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL avrxmega7)
26 add_definitions(-DCONFIG_HAVE_OWN_ERRNO=1)
27 elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL msp430g2210)
28 add_definitions(-DCONFIG_DEBUG_PRINTF=0)
29 add_definitions(-DCONFIG_DEBUG_ASSERT=0)
32 add_definitions(-DCONFIG_DEBUG_PRINTF=0)
33 add_definitions(-DCONFIG_DEBUG_ASSERT=0)
34 add_definitions(-DCONFIG_HAVE_OWN_OFLAGS=1)
35 add_definitions(-DCONFIG_HAVE_OWN_ERRNO=0)
36 add_definitions(-DCONFIG_BLOCK_DEV_CACHE_SIZE=16)
38 #Generic example target
40 set(BLOCKDEV_TYPE windows)
42 set(BLOCKDEV_TYPE linux)
45 add_definitions(-DCONFIG_HAVE_OWN_OFLAGS=0)
46 add_definitions(-DCONFIG_HAVE_OWN_ERRNO=0)
47 add_definitions(-DCONFIG_HAVE_OWN_ASSERT=0)
48 add_definitions(-DCONFIG_BLOCK_DEV_CACHE_SIZE=16)
49 add_subdirectory(fs_test)
52 macro(output_configure)
56 PROPERTY COMPILE_DEFINITIONS
59 ${PROJECT_BINARY_DIR}/include/generated/ext4_config.h
61 foreach(item ${definitions})
62 string(REGEX MATCH "^CONFIG_" match_res ${item})
64 string(REGEX REPLACE "=(.+)$" "" replace_res ${item})
66 "#define ${replace_res} ${CMAKE_MATCH_1}"
69 ${PROJECT_BINARY_DIR}/include/generated/ext4_config.h
76 add_subdirectory(blockdev)
80 #Detect all possible warnings for lwext4 target
81 if (NOT CMAKE_COMPILER_IS_GNUCC)
82 set_target_properties(lwext4 PROPERTIES COMPILE_FLAGS "")
84 set_target_properties(lwext4 PROPERTIES COMPILE_FLAGS "-Wall -Wextra -pedantic")
87 #Config file generation
94 set(CPACK_PACKAGE_VERSION_MAJOR "${VERSION_MAJOR}")
95 set(CPACK_PACKAGE_VERSION_MINOR "${VERSION_MINOR}")
96 set(CPACK_PACKAGE_VERSION_PATCH "${VERSION_PATCH}")
97 set(CPACK_SOURCE_GENERATOR "TBZ2")
98 set(CPACK_SOURCE_PACKAGE_FILE_NAME
99 "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
100 set(CPACK_SOURCE_IGNORE_FILES
105 add_custom_target(dist COMMAND ${CMAKE_MAKE_PROGRAM} package_source)