diff options
author | iphydf <iphydf@users.noreply.github.com> | 2016-10-24 16:06:09 +0100 |
---|---|---|
committer | iphydf <iphydf@users.noreply.github.com> | 2016-10-26 13:34:29 +0100 |
commit | de966cdf90843819e2f7287e22ddcb5f95491b18 (patch) | |
tree | 2c92c01a69db30a9912581807a78cdeff974aa3c /cmake | |
parent | 09c8575a7d93c8f9302330620f95645757ab276e (diff) |
Error if format_test can't be executed.
This ensures that on Travis, format_test will always be executed, or the
build fails.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/ApiDsl.cmake | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/cmake/ApiDsl.cmake b/cmake/ApiDsl.cmake index 777714ab..759f7f05 100644 --- a/cmake/ApiDsl.cmake +++ b/cmake/ApiDsl.cmake | |||
@@ -10,14 +10,29 @@ find_program(APIDSL NAMES | |||
10 | apidsl.byte | 10 | apidsl.byte |
11 | ${CMAKE_SOURCE_DIR}/../apidsl/apigen.native) | 11 | ${CMAKE_SOURCE_DIR}/../apidsl/apigen.native) |
12 | find_program(ASTYLE NAMES | 12 | find_program(ASTYLE NAMES |
13 | astyle) | 13 | astyle |
14 | $ENV{ASTYLE}) | ||
14 | 15 | ||
15 | function(apidsl) | 16 | function(apidsl) |
16 | if(APIDSL AND ASTYLE) | 17 | if(APIDSL AND ASTYLE) |
17 | foreach(in_file ${ARGN}) | 18 | foreach(in_file ${ARGN}) |
18 | get_filename_component(dirname ${in_file} DIRECTORY) | 19 | # Get the directory component of the input file name. |
20 | if(CMAKE_VERSION VERSION_LESS 3.0) | ||
21 | execute_process( | ||
22 | COMMAND dirname ${in_file} | ||
23 | OUTPUT_VARIABLE dirname | ||
24 | OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
25 | else() | ||
26 | get_filename_component(dirname ${in_file} DIRECTORY) | ||
27 | endif() | ||
28 | |||
29 | # Get the name without extension (i.e. without ".api.h"). | ||
19 | get_filename_component(filename ${in_file} NAME_WE) | 30 | get_filename_component(filename ${in_file} NAME_WE) |
31 | |||
32 | # Put them together, with the new extension that is ".h". | ||
20 | set(out_file ${CMAKE_SOURCE_DIR}/${dirname}/${filename}.h) | 33 | set(out_file ${CMAKE_SOURCE_DIR}/${dirname}/${filename}.h) |
34 | |||
35 | # Run apidsl. | ||
21 | add_custom_command( | 36 | add_custom_command( |
22 | OUTPUT ${out_file} | 37 | OUTPUT ${out_file} |
23 | COMMAND "${APIDSL}" "${CMAKE_SOURCE_DIR}/${in_file}" | 38 | COMMAND "${APIDSL}" "${CMAKE_SOURCE_DIR}/${in_file}" |