Skip to content

Commit

Permalink
{CMakeLists.txt,cmake}: Use tab(\t) as indent
Browse files Browse the repository at this point in the history
Signed-off-by: Rong Tao <[email protected]>
  • Loading branch information
Rtoax committed May 8, 2024
1 parent 38644a7 commit f7faf33
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 84 deletions.
12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,12 @@ endif(BUILD_MAN)

# uninstall targets
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)

add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()

28 changes: 14 additions & 14 deletions cmake/cmake_uninstall.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
# Copyright (C) 2022-2024 Rong Tao <[email protected]>
#
if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt")
endif()

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()
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif()
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()
else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File $ENV{DESTDIR}${file} does not exist.")
endif()
endforeach()
19 changes: 8 additions & 11 deletions cmake/find_binutils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,20 @@
# BINUTILS_BFD_H - the binutils has version.h header

find_path(BINUTILS_INCLUDE_DIRS
NAMES
bfd.h
PATHS
ENV CPATH)
NAMES bfd.h
PATHS ENV CPATH)

find_library(BINUTILS_BFD_LIBRARIES
NAMES
bfd
PATHS
ENV LIBRARY_PATH
ENV LD_LIBRARY_PATH)
NAMES bfd
PATHS
ENV LIBRARY_PATH
ENV LD_LIBRARY_PATH)

include(FindPackageHandleStandardArgs)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(binutils-devel "Please install the binutils-devel development package"
BINUTILS_BFD_LIBRARIES
BINUTILS_INCLUDE_DIRS)
BINUTILS_BFD_LIBRARIES
BINUTILS_INCLUDE_DIRS)

SET(CMAKE_REQUIRED_LIBRARIES elf)
INCLUDE(CheckCSourceCompiles)
Expand Down
13 changes: 5 additions & 8 deletions cmake/find_capstone.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,20 @@
# CAPSTONE_CAPSTONE_H - the capstone has capstone.h header

find_path(CAPSTONE_INCLUDE_DIRS
NAMES
capstone.h
PATH_SUFFIXES
capstone
PATHS
ENV CPATH)
NAMES capstone.h
PATH_SUFFIXES capstone
PATHS ENV CPATH)

include(FindPackageHandleStandardArgs)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(capstone-devel "Please install the capstone-devel development package"
CAPSTONE_INCLUDE_DIRS)
CAPSTONE_INCLUDE_DIRS)

SET(CMAKE_REQUIRED_LIBRARIES capstone)
INCLUDE(CheckCSourceCompiles)
CHECK_C_SOURCE_COMPILES("
#include <capstone/capstone.h>
int main() {
int main(void) {
return 0;
}" CAPSTONE_CAPSTONE_H)
SET(CMAKE_REQUIRED_LIBRARIES)
Expand Down
13 changes: 5 additions & 8 deletions cmake/find_elfutils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,21 @@
# ELFUTILS_VERSION_H - the elfutils has version.h header

find_path(ELFUTILS_INCLUDE_DIRS
NAMES
version.h
PATH_SUFFIXES
elfutils
PATHS
ENV CPATH)
NAMES version.h
PATH_SUFFIXES elfutils
PATHS ENV CPATH)

include(FindPackageHandleStandardArgs)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(elfutils-devel
"Please install the elfutils-devel(if rpm), libelf-dev(if deb) development package"
ELFUTILS_INCLUDE_DIRS)
ELFUTILS_INCLUDE_DIRS)

SET(CMAKE_REQUIRED_LIBRARIES elf)
INCLUDE(CheckCSourceCompiles)
CHECK_C_SOURCE_COMPILES("
#include <elfutils/version.h>
int main() {
int main(void) {
return 0;
}" ELFUTILS_VERSION_H)
SET(CMAKE_REQUIRED_LIBRARIES)
Expand Down
15 changes: 6 additions & 9 deletions cmake/find_kernel_headers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,25 @@
#

find_path(KERNEL_HEADERS_INCLUDE_DIRS
NAMES
version.h
PATH_SUFFIXES
linux
PATHS
ENV CPATH)
NAMES version.h
PATH_SUFFIXES linux
PATHS ENV CPATH)

include(FindPackageHandleStandardArgs)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(kernel-headers "Please install the kernel-headers development package"
KERNEL_HEADERS_INCLUDE_DIRS)
KERNEL_HEADERS_INCLUDE_DIRS)

SET(CMAKE_REQUIRED_LIBRARIES elf)
INCLUDE(CheckCSourceCompiles)
CHECK_C_SOURCE_COMPILES("
#include <linux/const.h>
int main() {
int main(void) {
return 0;
}" KERNEL_HEADERS_CONST_H)
CHECK_C_SOURCE_COMPILES("
#include <linux/const.h>
int main() {
int main(void) {
long a = __ALIGN_KERNEL(1, 0);
return 0;
}" KERNEL_HEADERS_CONST___ALIGN_KERNEL_H)
Expand Down
28 changes: 12 additions & 16 deletions cmake/find_libelf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,29 @@
# ELF_GETSHDRSTRNDX - the libelf has elf_getshdrstrndx() api

find_path(LIBELF_INCLUDE_DIRS
NAMES
libelf.h
PATH_SUFFIXES
libelf
PATHS
ENV CPATH)
NAMES libelf.h
PATH_SUFFIXES libelf
PATHS
ENV CPATH)

find_library(LIBELF_LIBRARIES
NAMES
elf
PATH_SUFFIXES
libelf
PATHS
ENV LIBRARY_PATH
ENV LD_LIBRARY_PATH)
NAMES elf
PATH_SUFFIXES libelf
PATHS
ENV LIBRARY_PATH
ENV LD_LIBRARY_PATH)

include(FindPackageHandleStandardArgs)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibElf "Please install the libelf development package"
LIBELF_LIBRARIES
LIBELF_INCLUDE_DIRS)
LIBELF_LIBRARIES
LIBELF_INCLUDE_DIRS)

SET(CMAKE_REQUIRED_LIBRARIES elf)
INCLUDE(CheckCSourceCompiles)
CHECK_C_SOURCE_COMPILES("
#include <libelf.h>
int main() {
int main(void) {
Elf *e = (Elf*)0;
size_t sz;
elf_getshdrstrndx(e, &sz);
Expand Down
21 changes: 9 additions & 12 deletions cmake/find_libunwind.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,26 @@
# LIBUNWIND_LIBUNWIND_H - Has libunwind.h

find_path(LIBUNWIND_INCLUDE_DIRS
NAMES
libunwind.h
PATHS
ENV CPATH)
NAMES libunwind.h
PATHS ENV CPATH)

find_library(LIBUNWIND_LIBRARIES
NAMES
unwind
PATHS
ENV LIBRARY_PATH
ENV LD_LIBRARY_PATH)
NAMES unwind
PATHS
ENV LIBRARY_PATH
ENV LD_LIBRARY_PATH)

include(FindPackageHandleStandardArgs)

FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibElf "Please install the libunwind development package"
LIBUNWIND_LIBRARIES
LIBUNWIND_INCLUDE_DIRS)
LIBUNWIND_LIBRARIES
LIBUNWIND_INCLUDE_DIRS)

SET(CMAKE_REQUIRED_LIBRARIES unwind)
INCLUDE(CheckCSourceCompiles)
CHECK_C_SOURCE_COMPILES("
#include <libunwind.h>
int main() {
int main(void) {
return 0;
}" LIBUNWIND_LIBUNWIND_H)
SET(CMAKE_REQUIRED_LIBRARIES)
Expand Down

0 comments on commit f7faf33

Please sign in to comment.