X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=cmake%2Fcmake.d%2F03-macros.cmake;h=fa4bd1f0da800cc02cba99e933d372ce785f9562;hb=3465ddbdec8d77e2a59315e50f954ea2d35aa1cb;hp=8af81d6e5fe5740261bf46aef4bd9f897ab01da2;hpb=9116b93f53127e48f3821497440500b6b78989c6;p=apps%2Fapp-templates.git diff --git a/cmake/cmake.d/03-macros.cmake b/cmake/cmake.d/03-macros.cmake index 8af81d6..fa4bd1f 100644 --- a/cmake/cmake.d/03-macros.cmake +++ b/cmake/cmake.d/03-macros.cmake @@ -127,16 +127,31 @@ macro(add_input_files INPUT_FILES) set(ext_reg "xml$") set(XML_LIST ${INPUT_FILES}) list_filter(XML_LIST ext_reg) + execute_process( + COMMAND which ${XML_CHECKER} + RESULT_VARIABLE XML_CHECKER_PRESENT + OUTPUT_QUIET ERROR_QUIET + ) endif() if(NOT DEFINED LUA_LIST) set(ext_reg "lua$") set(LUA_LIST ${INPUT_FILES}) list_filter(LUA_LIST ext_reg) + execute_process( + COMMAND which ${LUA_CHECKER} + RESULT_VARIABLE LUA_CHECKER_PRESENT + OUTPUT_QUIET ERROR_QUIET + ) endif() if(NOT DEFINED JSON_FILES) set(ext_reg "json$") set(JSON_LIST ${INPUT_FILES}) list_filter(JSON_LIST ext_reg) + execute_process( + COMMAND which ${JSON_CHECKER} + RESULT_VARIABLE JSON_CHECKER_PRESENT + OUTPUT_QUIET ERROR_QUIET + ) endif() # These are v3.6 subcommand. Not used as default for now as @@ -149,27 +164,48 @@ macro(add_input_files INPUT_FILES) DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} ) - foreach(file ${XML_LIST}) + if(XML_CHECKER_PRESENT EQUAL 0) + foreach(file ${XML_LIST}) + add_custom_command(TARGET ${TARGET_NAME} + PRE_BUILD + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ${XML_CHECKER} ${file} + ) + endforeach() + elseif(XML_LIST) + add_custom_command(TARGET ${TARGET_NAME} + PRE_BUILD + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red "Warning: XML_CHECKER not found. Not verification made on files !") + endif() + if(LUA_CHECKER_PRESENT EQUAL 0) + foreach(file ${LUA_LIST}) add_custom_command(TARGET ${TARGET_NAME} PRE_BUILD WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND which ${XML_CHECKER} > /dev/null 2>&1 && ${XML_CHECKER} ${file} || ${CMAKE_COMMAND} -E cmake_echo_color --red "Warning: XML_CHECKER not found" + COMMAND ${LUA_CHECKER} ${file} ) - endforeach() - foreach(file ${LUA_LIST}) - add_custom_command(TARGET ${TARGET_NAME} - PRE_BUILD - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND which ${LUA_CHECKER} > /dev/null 2>&1 && ${LUA_CHECKER} ${file} || ${CMAKE_COMMAND} -E cmake_echo_color --red "Warning: LUA_CHECKER not found" - ) - endforeach() - foreach(file ${JSON_LIST}) + endforeach() + elseif(LUA_LIST) + add_custom_command(TARGET ${TARGET_NAME} + PRE_BUILD + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red "Warning: LUA_CHECKER not found. Not verification made on files !") + endif() + if(JSON_CHECKER_PRESENT EQUAL 0) + foreach(file ${JSON_LIST}) + add_custom_command(TARGET ${TARGET_NAME} + PRE_BUILD + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ${JSON_CHECKER} ${file} + ) + endforeach() + elseif(JSON_LIST) add_custom_command(TARGET ${TARGET_NAME} - PRE_BUILD - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND which ${JSON_CHECKER} > /dev/null 2>&1 && ${JSON_CHECKER} ${file} || ${CMAKE_COMMAND} -E cmake_echo_color --red "Warning: JSON_CHECKER not found" - ) - endforeach() + PRE_BUILD + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --red "Warning: JSON_CHECKER not found. Not verification made on files !") + endif() add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} DEPENDS ${INPUT_FILES}