Re: [PATCH 0/3] Build improvements for clar

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Phillip Wood <phillip.wood123@xxxxxxxxx> writes:

> I've been using the CMake build in Visual Studio the last couple of days
> as my hard drive with linux on it died. I ended up with a slightly
> different fix using "sh -c" rather than putting the awk script inside
> a shell script. See the diff below. I don't have a strong preference
> either way but it would be nice to fix the line wrapping and add
> VERBATIM so that paths containing special characters are quoted correctly

Thanks for comments.

I've committed the same sin number of times, but a scriptlet written
in a third language as a string literal in a shell script is
somewhat awkward to maintain, so I may have slight preference for
your variant.  Either way, we are now letting the shell, and not
CMake, to spawn "awk", so if that was the reason why the file needs
to be changed (i.e. CMake perhaps failed to or found a wrong awk),
either of your two approaches would solve that by delegating the
task to the shell.




>
> Best Wishes
>
> Phillip
>
> ---- >8 ----
>
> diff --git a/contrib/buildsystems/CMakeLists.txt b/contrib/buildsystems/CMakeLists.txt
> index f0a1a75382a..b8a37b3870d 100644
> --- a/contrib/buildsystems/CMakeLists.txt
> +++ b/contrib/buildsystems/CMakeLists.txt
> @@ -989,11 +989,21 @@ parse_makefile_for_scripts(clar_test_SUITES "CLAR_TEST_SUITES" "")
>  list(TRANSFORM clar_test_SUITES PREPEND "${CMAKE_SOURCE_DIR}/t/unit-tests/")
>  list(TRANSFORM clar_test_SUITES APPEND ".c")
>  add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/t/unit-tests/clar-decls.h"
> -        COMMAND ${CMAKE_SOURCE_DIR}/t/unit-tests/generate-clar-decls.sh "${CMAKE_BINARY_DIR}/t/unit-tests/clar-decls.h" ${clar_test_SUITES}
> -        DEPENDS ${CMAKE_SOURCE_DIR}/t/unit-tests/generate-clar-decls.sh ${clar_test_SUITES})
> +        COMMAND ${SH_EXE}
> +                "${CMAKE_SOURCE_DIR}/t/unit-tests/generate-clar-decls.sh"
> +                "${CMAKE_BINARY_DIR}/t/unit-tests/clar-decls.h"
> +                ${clar_test_SUITES}
> +        DEPENDS "${CMAKE_SOURCE_DIR}/t/unit-tests/generate-clar-decls.sh"
> +                ${clar_test_SUITES}
> +        VERBATIM)
>  add_custom_command(OUTPUT "${CMAKE_BINARY_DIR}/t/unit-tests/clar.suite"
> -        COMMAND awk -f "${CMAKE_SOURCE_DIR}/t/unit-tests/clar-generate.awk" "${CMAKE_BINARY_DIR}/t/unit-tests/clar-decls.h" > "${CMAKE_BINARY_DIR}/t/unit-tests/clar.suite"
> -        DEPENDS "${CMAKE_SOURCE_DIR}/t/unit-tests/clar-generate.awk" "${CMAKE_BINARY_DIR}/t/unit-tests/clar-decls.h")
> +        COMMAND ${SH_EXE} "-c" [[awk -f "$1" "$2" >"$3"]] awk
> +                "${CMAKE_SOURCE_DIR}/t/unit-tests/clar-generate.awk"
> +                "${CMAKE_BINARY_DIR}/t/unit-tests/clar-decls.h"
> +                "${CMAKE_BINARY_DIR}/t/unit-tests/clar.suite"
> +        DEPENDS "${CMAKE_SOURCE_DIR}/t/unit-tests/clar-generate.awk"
> +                "${CMAKE_BINARY_DIR}/t/unit-tests/clar-decls.h"
> +        VERBATIM)
>    add_library(unit-tests-lib ${clar_test_SUITES}
>          "${CMAKE_SOURCE_DIR}/t/unit-tests/clar/clar.c"




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux