From a69ab0c23a0c38e3fed3e412df36538d8959d23c Mon Sep 17 00:00:00 2001 From: Martin Braun Date: Tue, 13 Nov 2018 21:53:22 -0800 Subject: cmake: Update coding style to use lowercase commands Also updates our coding style file. Ancient CMake versions required upper-case commands. Later command names became case-insensitive. Now the preferred style is lower-case. Run the following shell code (with GNU compliant sed): cmake --help-command-list | grep -v "cmake version" | while read c; do echo 's/\b'"$(echo $c | tr '[:lower:]' '[:upper:]')"'\(\s*\)(/'"$c"'\1(/g' done > convert.sed \ && git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' \ '*CMakeLists.txt' | xargs -0 gsed -i -f convert.sed && rm convert.sed (Make sure the backslashes don't get mangled!) --- host/cmake/Modules/UHDBuildInfo.cmake | 66 +++++++++++++++++------------------ 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'host/cmake/Modules/UHDBuildInfo.cmake') diff --git a/host/cmake/Modules/UHDBuildInfo.cmake b/host/cmake/Modules/UHDBuildInfo.cmake index 21b1e3c1d..468635b15 100644 --- a/host/cmake/Modules/UHDBuildInfo.cmake +++ b/host/cmake/Modules/UHDBuildInfo.cmake @@ -8,46 +8,46 @@ # We need this to be macro because GET_DIRECTORY_PROPERTY works with # the current directory. # -MACRO(UHD_LOAD_BUILD_INFO) - MESSAGE(STATUS "") - MESSAGE(STATUS "Loading build info.") +macro(UHD_LOAD_BUILD_INFO) + message(STATUS "") + message(STATUS "Loading build info.") # Build date - IF(IGNORE_BUILD_DATE) - SET(UHD_BUILD_DATE "") - ELSE() - EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c + if(IGNORE_BUILD_DATE) + set(UHD_BUILD_DATE "") + else() + execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import time; print(time.strftime('%a, %d %b %Y %H:%M:%S', time.gmtime()))" OUTPUT_VARIABLE UHD_BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE ) - ENDIF(IGNORE_BUILD_DATE) + endif(IGNORE_BUILD_DATE) # Compiler name - IF(MSVC) - IF(MSVC10) - SET(UHD_C_COMPILER "MSVC 2010") - SET(UHD_CXX_COMPILER "MSVC 2010") - ELSEIF(MSVC11) - SET(UHD_C_COMPILER "MSVC 2012") - SET(UHD_CXX_COMPILER "MSVC 2012") - ELSEIF(MSVC12) - SET(UHD_C_COMPILER "MSVC 2013") - SET(UHD_CXX_COMPILER "MSVC 2013") - ELSEIF(MSVC14) - SET(UHD_C_COMPILER "MSVC 2015") - SET(UHD_CXX_COMPILER "MSVC 2015") - ELSE() + if(MSVC) + if(MSVC10) + set(UHD_C_COMPILER "MSVC 2010") + set(UHD_CXX_COMPILER "MSVC 2010") + elseif(MSVC11) + set(UHD_C_COMPILER "MSVC 2012") + set(UHD_CXX_COMPILER "MSVC 2012") + elseif(MSVC12) + set(UHD_C_COMPILER "MSVC 2013") + set(UHD_CXX_COMPILER "MSVC 2013") + elseif(MSVC14) + set(UHD_C_COMPILER "MSVC 2015") + set(UHD_CXX_COMPILER "MSVC 2015") + else() # Go with the ugly string - SET(UHD_C_COMPILER "MSVC ${CMAKE_C_COMPILER_VERSION}") - SET(UHD_CXX_COMPILER "MSVC ${CMAKE_CXX_COMPILER_VERSION}") - ENDIF(MSVC10) - ELSE() - SET(UHD_C_COMPILER "${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}") - SET(UHD_CXX_COMPILER "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}") - ENDIF(MSVC) + set(UHD_C_COMPILER "MSVC ${CMAKE_C_COMPILER_VERSION}") + set(UHD_CXX_COMPILER "MSVC ${CMAKE_CXX_COMPILER_VERSION}") + endif(MSVC10) + else() + set(UHD_C_COMPILER "${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}") + set(UHD_CXX_COMPILER "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}") + endif(MSVC) # Compiler flags - GET_DIRECTORY_PROPERTY(uhd_flags COMPILE_DEFINITIONS) - SET(UHD_C_FLAGS "${uhd_flags}${CMAKE_C_FLAGS}") # CMAKE_C_FLAGS starts with a space - SET(UHD_CXX_FLAGS "${uhd_flags}${CMAKE_CXX_FLAGS}") # CMAKE_CXX_FLAGS starts with a space -ENDMACRO(UHD_LOAD_BUILD_INFO) + get_directory_property(uhd_flags COMPILE_DEFINITIONS) + set(UHD_C_FLAGS "${uhd_flags}${CMAKE_C_FLAGS}") # CMAKE_C_FLAGS starts with a space + set(UHD_CXX_FLAGS "${uhd_flags}${CMAKE_CXX_FLAGS}") # CMAKE_CXX_FLAGS starts with a space +endmacro(UHD_LOAD_BUILD_INFO) -- cgit v1.2.3