~mardy/unity-scopes-api/clientid-1554040

« back to all changes in this revision

Viewing changes to CMakeLists.txt

  • Committer: Michi Henning
  • Date: 2014-01-28 05:05:08 UTC
  • mto: (163.1.2 devel)
  • mto: This revision was merged to the branch mainline in revision 160.
  • Revision ID: michi.henning@canonical.com-20140128050508-vhevsex5lgflh0mj
Added formatcode script to build/tools to make it easy
to format individual source files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
74
74
if (NOT ASTYLE_COMMAND)
75
75
    message(WARNING "Cannot find astyle: formatcode target will not be available")
76
76
else()
77
 
    find_program(CLANG_FORMAT_COMMAND NAMES clang-format-3.5)
78
 
    if (NOT CLANG_FORMAT_COMMAND)
79
 
        message(WARNING "Cannot find clang-format >= clang-format-3.5: formatcode target will not be available")
 
77
    # astyle 2.03 creates DOS line endings, so we need to fix its output
 
78
    find_program(DOS2UNIX_COMMAND NAMES dos2unix)
 
79
    if (NOT DOS2UNIX_COMMAND)
 
80
        message(WARNING "Cannot find dos2unix: formatcode target will not be available")
 
81
    else()
 
82
        find_program(CLANG_FORMAT_COMMAND NAMES clang-format-3.5)
 
83
        if (NOT CLANG_FORMAT_COMMAND)
 
84
            message(WARNING "Cannot find clang-format >= clang-format-3.5: formatcode target will not be available")
 
85
        endif()
80
86
    endif()
81
87
endif()
82
88
 
83
 
if (ASTYLE_COMMAND AND CLANG_FORMAT_COMMAND)
 
89
if (ASTYLE_COMMAND AND DOS2UNIX_COMMAND AND CLANG_FORMAT_COMMAND)
84
90
set(UNITY_SCOPES_LIB_HDRS ${UNITY_SCOPES_LIB_HDRS} ${fmt_h})
85
91
    add_custom_target(formatcode
86
92
                      ${PROJECT_SOURCE_DIR}/tools/format-files.sh ${PROJECT_SOURCE_DIR} ${ASTYLE_COMMAND} ${CLANG_FORMAT_COMMAND})
259
265
add_subdirectory(data)
260
266
add_subdirectory(test)
261
267
add_subdirectory(demo)
 
268
add_subdirectory(tools)
262
269
 
263
270
# Custom rules to compile .capnp files
264
271
foreach(file ${CAPNPROTO_FILES})