CMake - CMake Digest, Vol 160, Issue 70

Send CMake mailing list submissions to cmake@cmake.org To subscribe or unsubscribe via the World Wide Web, visit https://cmake.org or, via email, send a message with subject or body 'help' to cmake-request@cmake.org You can reach the person managing the list at cmake-owner@cmake.org When replying, please edit your Subject line so it is more specific than "Re: Contents of CMake digest..." Today's Topics: 1. Re: 'cmake.exe -G Ninja' doesn't work for VS2017 with cmake ver 3.9.1 (Masaru Tsuchiyama) 2. Please update the documentation for execute_process (Jeffrey Walton) 3. Re: Please update the documentation for execute_process (Jeffrey Walton) 4. Re: Please update the documentation for execute_process (Andreas Naumann) ---------------------------------------------------------------------- Message: 1 Date: Fri, 25 Aug 2017 22:04:40 +0900 From: Masaru Tsuchiyama To: Brad King Cc: cmake@cmake.org Subject: Re: [CMake] 'cmake.exe -G Ninja' doesn't work for VS2017 with cmake ver 3.9.1 Message-ID: <88f2ee77-6d9a-4e28-bc86-e95dd68e7cdc@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Hello I confirmed this is fixed. I used 9538d22d955a0b101548019003f2d5c7ba833d77 for the check. Brad King wrote: > On 08/23/2017 05:07 AM, masaru tsuchiyama wrote: >> It seems your coworker can reproduce it and you can use the PC tomorrow. >> So I don't need to debug it, right? > > Correct, thanks. See issue for further updates. > > -Brad > -- Masaru Tsuchiyama ------------------------------ Message: 2 Date: Fri, 25 Aug 2017 10:06:59 -0400 From: Jeffrey Walton To: cmake@cmake.org Subject: [CMake] Please update the documentation for execute_process Message-ID: Content-Type: text/plain; charset="UTF-8" The documentation for execute_process has some room for improvement. We recently got burned by a problem that has existed since at least 2011: https://cmake.org . Once we learned the problem we could research a bit. The problem cost us over 8 man hours when it should not have been a problem in the first place. Considering there's nothing special about us, it has probably wasted thousands of man hours over the years. Here are the actionable items for the execute_process documentation task: * please clearly state the first argument is the command only, and not command + arguments * please clearly state whether arguments need to be quoted * please clearly state whether arguments need to be comma separated * please provide an example (or examples) to show how to specify multiple arguments for a command * please provide an example (or examples) to show how to redirect output when using a command Below is a typical case for us (https://cmake.org). If it looks pretty shitty, it probably is. That's the best we have been able to come up with based on the documentation. ********** ------------------------------ Message: 3 Date: Fri, 25 Aug 2017 10:12:25 -0400 From: Jeffrey Walton To: cmake@cmake.org Subject: Re: [CMake] Please update the documentation for execute_process Message-ID: Content-Type: text/plain; charset="UTF-8" > Below is a typical case for us > (https://cmake.org). If > it looks pretty shitty, it probably is. That's the best we have been > able to come up with based on the documentation. Below is the example code. We don't know whether it should be: set(SHELL_CMD sh) set(SHELL_ARGS -c) set(GREP_CMD egrep) set(GREP_ARGS -i -c) execute_process(COMMAND ${SHELL_CMD} ${SHELL_ARGS} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" COMMAND ${GREP_CMD} ${GREP_ARGS} "amd64" OUTPUT_VARIABLE CRYPTOPP_AMD64 OUTPUT_STRIP_TRAILING_WHITESPACE) Or: COMMAND "${SHELL_CMD}", "${CMAKE_CXX_COMPILER}", "-dumpmachine", "2>&1" Or: COMMAND "${SHELL_CMD}" "${CMAKE_CXX_COMPILER}" "-dumpmachine" "2>&1" Or: set(SHELL_CMD sh) set(GREP_CMD egrep) execute_process(COMMAND ${SHELL_CMD} "-c" "${CMAKE_CXX_COMPILER} "-dumpmachine" "2>&1" COMMAND ${GREP_CMD} ${GREP_ARGS} "-i" "-c" "amd64" OUTPUT_VARIABLE CRYPTOPP_AMD64 OUTPUT_STRIP_TRAILING_WHITESPACE) And we certainly don't know what to do with "2>&1" because there is no example. Jeff ********** set(SHELL_CMD sh -c) set(GREP_CMD egrep -i -c) execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" COMMAND ${GREP_CMD} "amd64" OUTPUT_VARIABLE CRYPTOPP_AMD64 OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" COMMAND ${GREP_CMD} "x86_64" OUTPUT_VARIABLE CRYPTOPP_X86_64 OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" COMMAND ${GREP_CMD} "i.86" OUTPUT_VARIABLE CRYPTOPP_I386 OUTPUT_STRIP_TRAILING_WHITESPACE) # https://cmake.org execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" COMMAND ${GREP_CMD} "mingw32" OUTPUT_VARIABLE CRYPTOPP_MINGW32 OUTPUT_STRIP_TRAILING_WHITESPACE) # https://cmake.org execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" COMMAND ${GREP_CMD} "w64-mingw32" OUTPUT_VARIABLE CRYPTOPP_MINGW64 OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" COMMAND ${GREP_CMD} "x32" OUTPUT_VARIABLE CRYPTOPP_X32 OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" COMMAND ${GREP_CMD} "Aarch32" OUTPUT_VARIABLE CRYPTOPP_AARCH32 OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" COMMAND ${GREP_CMD} "Aarch64" OUTPUT_VARIABLE CRYPTOPP_AARCH64 OUTPUT_STRIP_TRAILING_WHITESPACE) # https://cmake.org execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" COMMAND ${GREP_CMD} "\\" OUTPUT_VARIABLE CRYPTOPP_ARM OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" COMMAND ${GREP_CMD} "ARMHF" OUTPUT_VARIABLE CRYPTOPP_ARMHF OUTPUT_STRIP_TRAILING_WHITESPACE) execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" COMMAND ${GREP_CMD} "ARM7L" OUTPUT_VARIABLE CRYPTOPP_ARM7L OUTPUT_STRIP_TRAILING_WHITESPACE) # Fixup? if ("${CRYPTOPP_MINGW64}" STREQUAL "1") unset(CRYPTOPP_MINGW32) endif() # MinGW32 if ("${CRYPTOPP_MINGW32}" STREQUAL "1") set(CRYPTOPP_I386 "1") endif() # OpenBSD and MinGW64 if ("${CRYPTOPP_X86_64}" STREQUAL "1" OR "${CRYPTOPP_MINGW64}" STREQUAL "1") set(CRYPTOPP_AMD64 "1") endif() # arm7l is another 32-bit hard float machine. RPI-3 is arm7l on 64-bit hardware if ("${CRYPTOPP_ARM}" STREQUAL "1" OR "${CRYPTOPP_ARM7L}" STREQUAL "1") set(CRYPTOPP_ARMHF "1") endif() ------------------------------ Message: 4 Date: Fri, 25 Aug 2017 17:47:25 +0200 From: Andreas Naumann To: cmake@cmake.org Subject: Re: [CMake] Please update the documentation for execute_process Message-ID: <0137770f-36ce-044e-6e56-8fc6a51ce062@gmx.net> Content-Type: text/plain; charset=windows-1252; format=flowed Am 25.08.2017 um 16:12 schrieb Jeffrey Walton: >> Below is a typical case for us >> (https://cmake.org). If >> it looks pretty shitty, it probably is. That's the best we have been >> able to come up with based on the documentation. > Below is the example code. We don't know whether it should be: > > set(SHELL_CMD sh) > set(SHELL_ARGS -c) > set(GREP_CMD egrep) > set(GREP_ARGS -i -c) > > execute_process(COMMAND ${SHELL_CMD} ${SHELL_ARGS} > "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" > COMMAND ${GREP_CMD} ${GREP_ARGS} "amd64" > OUTPUT_VARIABLE CRYPTOPP_AMD64 > OUTPUT_STRIP_TRAILING_WHITESPACE) > > Or: > > COMMAND "${SHELL_CMD}", "${CMAKE_CXX_COMPILER}", "-dumpmachine", "2>&1" > > Or: > > COMMAND "${SHELL_CMD}" "${CMAKE_CXX_COMPILER}" "-dumpmachine" "2>&1" > > Or: > > set(SHELL_CMD sh) > set(GREP_CMD egrep) > > execute_process(COMMAND ${SHELL_CMD} "-c" "${CMAKE_CXX_COMPILER} > "-dumpmachine" "2>&1" > COMMAND ${GREP_CMD} ${GREP_ARGS} "-i" "-c" "amd64" > OUTPUT_VARIABLE CRYPTOPP_AMD64 > OUTPUT_STRIP_TRAILING_WHITESPACE) > > And we certainly don't know what to do with "2>&1" because there is no example. The documentation states "If OUTPUT_VARIABLE or ERROR_VARIABLE are given the variable named will be set with the contents of the standard output and standard error pipes respectively. If the same variable is named for both pipes their output will be merged in the order produced so I would suspect to use something like execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-dumpmachine" OUTPUT_VARIABLE output_dump ERROR_VARIABLE output_dump) and then use a if( output_dump MATCHES "amd64" ) .. endif() block Does that work? > > Jeff > > ********** > > set(SHELL_CMD sh -c) > set(GREP_CMD egrep -i -c) > > execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" > COMMAND ${GREP_CMD} "amd64" > OUTPUT_VARIABLE CRYPTOPP_AMD64 > OUTPUT_STRIP_TRAILING_WHITESPACE) > > execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" > COMMAND ${GREP_CMD} "x86_64" > OUTPUT_VARIABLE CRYPTOPP_X86_64 > OUTPUT_STRIP_TRAILING_WHITESPACE) > > execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" > COMMAND ${GREP_CMD} "i.86" > OUTPUT_VARIABLE CRYPTOPP_I386 > OUTPUT_STRIP_TRAILING_WHITESPACE) > > # https://cmake.org > execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" > COMMAND ${GREP_CMD} "mingw32" > OUTPUT_VARIABLE CRYPTOPP_MINGW32 > OUTPUT_STRIP_TRAILING_WHITESPACE) > > # https://cmake.org > execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" > COMMAND ${GREP_CMD} "w64-mingw32" > OUTPUT_VARIABLE CRYPTOPP_MINGW64 > OUTPUT_STRIP_TRAILING_WHITESPACE) > > execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" > COMMAND ${GREP_CMD} "x32" > OUTPUT_VARIABLE CRYPTOPP_X32 > OUTPUT_STRIP_TRAILING_WHITESPACE) > > execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" > COMMAND ${GREP_CMD} "Aarch32" > OUTPUT_VARIABLE CRYPTOPP_AARCH32 > OUTPUT_STRIP_TRAILING_WHITESPACE) > > execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" > COMMAND ${GREP_CMD} "Aarch64" > OUTPUT_VARIABLE CRYPTOPP_AARCH64 > OUTPUT_STRIP_TRAILING_WHITESPACE) > > # https://cmake.org > execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" > COMMAND ${GREP_CMD} "\\" > OUTPUT_VARIABLE CRYPTOPP_ARM > OUTPUT_STRIP_TRAILING_WHITESPACE) > > execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" > COMMAND ${GREP_CMD} "ARMHF" > OUTPUT_VARIABLE CRYPTOPP_ARMHF > OUTPUT_STRIP_TRAILING_WHITESPACE) > > execute_process(COMMAND ${SHELL_CMD} "${CMAKE_CXX_COMPILER} -dumpmachine 2>&1" > COMMAND ${GREP_CMD} "ARM7L" > OUTPUT_VARIABLE CRYPTOPP_ARM7L > OUTPUT_STRIP_TRAILING_WHITESPACE) > > # Fixup? > if ("${CRYPTOPP_MINGW64}" STREQUAL "1") > unset(CRYPTOPP_MINGW32) > endif() > > # MinGW32 > if ("${CRYPTOPP_MINGW32}" STREQUAL "1") > set(CRYPTOPP_I386 "1") > endif() > # OpenBSD and MinGW64 > if ("${CRYPTOPP_X86_64}" STREQUAL "1" OR "${CRYPTOPP_MINGW64}" STREQUAL "1") > set(CRYPTOPP_AMD64 "1") > endif() > # arm7l is another 32-bit hard float machine. RPI-3 is arm7l on 64-bit hardware > if ("${CRYPTOPP_ARM}" STREQUAL "1" OR "${CRYPTOPP_ARM7L}" STREQUAL "1") > set(CRYPTOPP_ARMHF "1") > endif() ------------------------------ Subject: Digest Footer -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: https://cmake.org Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: https://cmake.org CMake Consulting: https://cmake.org CMake Training Courses: https://cmake.org Visit other Kitware open-source projects at https://cmake.org Follow this link to subscribe/unsubscribe: https://cmake.org ------------------------------ End of CMake Digest, Vol 160, Issue 70 **************************************