From 2852bb1bac8fcc111364d516c2bd31628ad264c7 Mon Sep 17 00:00:00 2001 From: Sander Vrijders Date: Fri, 3 Mar 2017 15:01:50 +0100 Subject: build: Format CMakeLists.txt files The CMakeLists files are now properly indented. --- cmake/AddCompileFlags.cmake | 17 ++++++++++++ cmake/CmakeUninstall.cmake.in | 21 +++++++++++++++ cmake/CompilerUtils.cmake | 2 +- cmake/FindProtobufC.cmake | 44 +++++++++++++++--------------- cmake/GitVersionGen.cmake | 58 ++++++++++++++++++++-------------------- cmake/MacroAddCompileFlags.cmake | 19 ------------- cmake/cmake_uninstall.cmake.in | 21 --------------- 7 files changed, 90 insertions(+), 92 deletions(-) create mode 100644 cmake/AddCompileFlags.cmake create mode 100644 cmake/CmakeUninstall.cmake.in delete mode 100644 cmake/MacroAddCompileFlags.cmake delete mode 100644 cmake/cmake_uninstall.cmake.in (limited to 'cmake') diff --git a/cmake/AddCompileFlags.cmake b/cmake/AddCompileFlags.cmake new file mode 100644 index 00000000..8f3877d9 --- /dev/null +++ b/cmake/AddCompileFlags.cmake @@ -0,0 +1,17 @@ +# - MACRO_ADD_COMPILE_FLAGS(<_target> "flags...") + +# Copyright (c) 2006, Oswald Buddenhagen, +# +# Redistribution and use is allowed according to the terms of the BSD license. + +macro(add_compile_flags _target _flg) + + get_target_property(_flags ${_target} COMPILE_FLAGS) + if (_flags) + set(_flags "${_flags} ${_flg}") + else (_flags) + set(_flags "${_flg}") + endif (_flags) + set_target_properties(${_target} PROPERTIES COMPILE_FLAGS "${_flags}") + +endmacro(add_compile_flags) diff --git a/cmake/CmakeUninstall.cmake.in b/cmake/CmakeUninstall.cmake.in new file mode 100644 index 00000000..4c07dc7b --- /dev/null +++ b/cmake/CmakeUninstall.cmake.in @@ -0,0 +1,21 @@ +if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") +endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") + +file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) +string(REGEX REPLACE "\n" ";" files "${files}") +foreach(file ${files}) + message(STATUS "Uninstalling $ENV{DESTDIR}${file}") + if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + exec_program( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + if(NOT "${rm_retval}" STREQUAL 0) + message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") + endif(NOT "${rm_retval}" STREQUAL 0) + else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + message(STATUS "File $ENV{DESTDIR}${file} does not exist.") + endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") +endforeach(file) diff --git a/cmake/CompilerUtils.cmake b/cmake/CompilerUtils.cmake index 5cea44b6..fb81b7e7 100644 --- a/cmake/CompilerUtils.cmake +++ b/cmake/CompilerUtils.cmake @@ -9,7 +9,7 @@ function(test_and_set_c_compiler_flag_global _flag) message(STATUS "Compiler supports flag ${_flag}, added globally") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_flag}" PARENT_SCOPE) else(${_retval}) - message(STATUS "Compiler does not support flag ${_flag}, discarded") + message(STATUS "Compiler does not support flag ${_flag}, discarded") endif() endfunction(test_and_set_c_compiler_flag_global) diff --git a/cmake/FindProtobufC.cmake b/cmake/FindProtobufC.cmake index 6b81d751..ff532a46 100644 --- a/cmake/FindProtobufC.cmake +++ b/cmake/FindProtobufC.cmake @@ -1,22 +1,22 @@ function(PROTOBUF_GENERATE_C SRCS HDRS) - if(NOT ARGN) + if (NOT ARGN) message(SEND_ERROR "Error: PROTOBUF_GENERATE_C() called without any proto files") return() - endif() + endif () - if(PROTOBUF_GENERATE_C_APPEND_PATH) + if (PROTOBUF_GENERATE_C_APPEND_PATH) # Create an include path for each file specified - foreach(FIL ${ARGN}) + foreach (FIL ${ARGN}) get_filename_component(ABS_FIL ${FIL} ABSOLUTE) get_filename_component(ABS_PATH ${ABS_FIL} PATH) list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) - if(${_contains_already} EQUAL -1) - list(APPEND _protobuf_include_path -I ${ABS_PATH}) - endif() - endforeach() - else() + if (${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${ABS_PATH}) + endif () + endforeach () + else () set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) - endif() + endif () set(${SRCS}) set(${HDRS}) @@ -29,7 +29,7 @@ function(PROTOBUF_GENERATE_C SRCS HDRS) add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb-c.c" - "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb-c.h" + "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb-c.h" COMMAND ${PROTOBUF_PROTOC_C_EXECUTABLE} ARGS --c_out=${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL} DEPENDS ${ABS_FIL} ${PROTOBUF_PROTOC_C_EXECUTABLE} @@ -44,31 +44,31 @@ endfunction() # By default have PROTOBUF_GENERATE_C macro pass -I to protoc # for each directory where a proto file is referenced. -if(NOT DEFINED PROTOBUF_GENERATE_C_APPEND_PATH) +if (NOT DEFINED PROTOBUF_GENERATE_C_APPEND_PATH) set(PROTOBUF_GENERATE_C_APPEND_PATH TRUE) -endif() +endif () # Find library find_library(PROTOBUF_C_LIBRARY - NAMES libprotobuf-c.so libprotobuf-c libprotobuf-c.dylib -) + NAMES libprotobuf-c.so libprotobuf-c libprotobuf-c.dylib + ) mark_as_advanced(PROTOBUF_C_LIBRARY) # Find the include directory find_path(PROTOBUF_C_INCLUDE_DIR - google/protobuf-c/protobuf-c.h -) + google/protobuf-c/protobuf-c.h + ) mark_as_advanced(PROTOBUF_C_INCLUDE_DIR) # Find the protoc-c Executable find_program(PROTOBUF_PROTOC_C_EXECUTABLE - NAMES protoc-c - DOC "The Google Protocol Buffers C Compiler" -) + NAMES protoc-c + DOC "The Google Protocol Buffers C Compiler" + ) mark_as_advanced(PROTOBUF_PROTOC_C_EXECUTABLE) find_package(PackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(ProtobufC DEFAULT_MSG - PROTOBUF_C_LIBRARY PROTOBUF_C_INCLUDE_DIR PROTOBUF_PROTOC_C_EXECUTABLE) +find_package_handle_standard_args(ProtobufC DEFAULT_MSG + PROTOBUF_C_LIBRARY PROTOBUF_C_INCLUDE_DIR PROTOBUF_PROTOC_C_EXECUTABLE) set(PROTOBUF_C_INCLUDE_DIRS ${PROTOBUF_C_INCLUDE_DIR}) diff --git a/cmake/GitVersionGen.cmake b/cmake/GitVersionGen.cmake index 53ac166d..718ec8a3 100644 --- a/cmake/GitVersionGen.cmake +++ b/cmake/GitVersionGen.cmake @@ -1,23 +1,23 @@ -macro(GIT_VERSION_GEN) +macro(git_version_gen) -include(FindGit) -if(NOT GIT_FOUND) - message(FATAL_ERROR "This is not a git repository") -endif() + include(FindGit) + if (NOT GIT_FOUND) + message(FATAL_ERROR "This is not a git repository") + endif () -find_program(SORT "sort") -mark_as_advanced(SORT) -if (${SORT} STREQUAL "") - message(FATAL_ERROR "Cannot find the sort executable") -endif() + find_program(SORT "sort") + mark_as_advanced(SORT) + if (${SORT} STREQUAL "") + message(FATAL_ERROR "Cannot find the sort executable") + endif () -find_program(TAIL "tail") -mark_as_advanced(TAIL) -if (${TAIL} STREQUAL "") - message(FATAL_ERROR "Cannot find the tail executable") -endif() + find_program(TAIL "tail") + mark_as_advanced(TAIL) + if (${TAIL} STREQUAL "") + message(FATAL_ERROR "Cannot find the tail executable") + endif () -execute_process( + execute_process( COMMAND ${GIT_EXECUTABLE} tag -l -n0 COMMAND ${SORT} -V COMMAND ${TAIL} -n 1 @@ -25,19 +25,19 @@ execute_process( OUTPUT_VARIABLE _git_tag RESULT_VARIABLE _git_result OUTPUT_STRIP_TRAILING_WHITESPACE) -if(NOT ${_git_result} EQUAL 0) - message(FATAL_ERROR "Cannot fetch repository tag") -endif() -message(STATUS "Repository tag is: ${_git_tag}") + if (NOT ${_git_result} EQUAL 0) + message(FATAL_ERROR "Cannot fetch repository tag") + endif () + message(STATUS "Repository tag is: ${_git_tag}") -string(REGEX REPLACE - "[^0-9]*([0-9]+)\\.[0-9]+.*" "\\1" - _version_major "${_git_tag}") -string(REGEX REPLACE - "[^0-9]*[0-9]+\\.([0-9]+).*" "\\1" - _version_minor "${_git_tag}") + string(REGEX REPLACE + "[^0-9]*([0-9]+)\\.[0-9]+.*" "\\1" + _version_major "${_git_tag}") + string(REGEX REPLACE + "[^0-9]*[0-9]+\\.([0-9]+).*" "\\1" + _version_minor "${_git_tag}") -set(PACKAGE_VERSION_MAJOR "${_version_major}") -set(PACKAGE_VERSION_MINOR "${_version_minor}") + set(PACKAGE_VERSION_MAJOR "${_version_major}") + set(PACKAGE_VERSION_MINOR "${_version_minor}") -endmacro(GIT_VERSION_GEN) +endmacro(git_version_gen) diff --git a/cmake/MacroAddCompileFlags.cmake b/cmake/MacroAddCompileFlags.cmake deleted file mode 100644 index 41f3797c..00000000 --- a/cmake/MacroAddCompileFlags.cmake +++ /dev/null @@ -1,19 +0,0 @@ -# - MACRO_ADD_COMPILE_FLAGS(<_target> "flags...") - -# Copyright (c) 2006, Oswald Buddenhagen, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - -macro(MACRO_ADD_COMPILE_FLAGS _target _flg) - - get_target_property(_flags ${_target} COMPILE_FLAGS) - if (_flags) - set(_flags "${_flags} ${_flg}") - else (_flags) - set(_flags "${_flg}") - endif (_flags) - set_target_properties(${_target} PROPERTIES COMPILE_FLAGS "${_flags}") - -endmacro(MACRO_ADD_COMPILE_FLAGS) diff --git a/cmake/cmake_uninstall.cmake.in b/cmake/cmake_uninstall.cmake.in deleted file mode 100644 index 4c07dc7b..00000000 --- a/cmake/cmake_uninstall.cmake.in +++ /dev/null @@ -1,21 +0,0 @@ -if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") - message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") -endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") - -file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) -string(REGEX REPLACE "\n" ";" files "${files}") -foreach(file ${files}) - message(STATUS "Uninstalling $ENV{DESTDIR}${file}") - if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") - exec_program( - "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" - OUTPUT_VARIABLE rm_out - RETURN_VALUE rm_retval - ) - if(NOT "${rm_retval}" STREQUAL 0) - message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") - endif(NOT "${rm_retval}" STREQUAL 0) - else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") - message(STATUS "File $ENV{DESTDIR}${file} does not exist.") - endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") -endforeach(file) -- cgit v1.2.3