diff options
author | Kip Warner <kip@thevertigo.com> | 2021-07-13 20:14:49 +0300 |
---|---|---|
committer | Kip Warner <kip@thevertigo.com> | 2021-07-13 20:14:49 +0300 |
commit | 2f10af38d2eab4e94f6d9204627e11400fe0995f (patch) | |
tree | 193bf70887e94f7c2f3c89b88376c574f3471784 | |
parent | c14bec00d22de3f1b71e6f65b019ebf24de660b5 (diff) |
CMakeLists.txt: Generate pkg-config manifest, even for static libraries if requested...
{CMakeLists.txt,libcpuinfo.pc.in}: Remove semantic versioning, as per @Maratyszcza's request...
CMakeLists.txt: Cosmetic formatting changes, per @Maratyszcza's request...
-rw-r--r-- | CMakeLists.txt | 41 | ||||
-rw-r--r-- | libcpuinfo.pc.in | 2 |
2 files changed, 21 insertions, 22 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 71b235b..2c25617 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,10 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.5 FATAL_ERROR) -# ---[ Project and semantic versioning. +# ---[ Setup project PROJECT( cpuinfo LANGUAGES C CXX - HOMEPAGE_URL https://github.com/pytorch/cpuinfo - VERSION 0.1.0) + HOMEPAGE_URL https://github.com/pytorch/cpuinfo) # ---[ Options. SET(CPUINFO_LIBRARY_TYPE "default" CACHE STRING "Type of cpuinfo library (shared, static, or default) to build") @@ -828,24 +827,24 @@ IF(CPUINFO_SUPPORTED_PLATFORM AND CPUINFO_BUILD_TOOLS) ENDIF() # ---[ pkg-config manifest. This is mostly from JsonCpp... -if(CPUINFO_BUILD_PKG_CONFIG AND (CPUINFO_LIBRARY_TYPE STREQUAL "default" OR CPUINFO_LIBRARY_TYPE STREQUAL "shared")) - - function(join_paths joined_path first_path_segment) - set(temp_path "${first_path_segment}") - foreach(current_segment IN LISTS ARGN) - if(NOT ("${current_segment}" STREQUAL "")) - if(IS_ABSOLUTE "${current_segment}") - set(temp_path "${current_segment}") - else() - set(temp_path "${temp_path}/${current_segment}") - endif() - endif() - endforeach() - set(${joined_path} "${temp_path}" PARENT_SCOPE) - endfunction() - -join_paths(libdir_for_pc_file "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}") -join_paths(includedir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}") +if(CPUINFO_BUILD_PKG_CONFIG) + + FUNCTION(JOIN_PATHS joined_path first_path_segment) + SET(temp_path "${first_path_segment}") + FOREACH(current_segment IN LISTS ARGN) + IF(NOT ("${current_segment}" STREQUAL "")) + IF(IS_ABSOLUTE "${current_segment}") + SET(temp_path "${current_segment}") + ELSE() + SET(temp_path "${temp_path}/${current_segment}") + ENDIF() + ENDIF() + ENDFOREACH() + SET(${joined_path} "${temp_path}" PARENT_SCOPE) + ENDFUNCTION() + +JOIN_PATHS(libdir_for_pc_file "\${exec_prefix}" "${CMAKE_INSTALL_LIBDIR}") +JOIN_PATHS(includedir_for_pc_file "\${prefix}" "${CMAKE_INSTALL_INCLUDEDIR}") configure_file( "libcpuinfo.pc.in" diff --git a/libcpuinfo.pc.in b/libcpuinfo.pc.in index dfcdd19..3027da3 100644 --- a/libcpuinfo.pc.in +++ b/libcpuinfo.pc.in @@ -5,7 +5,7 @@ includedir=@includedir_for_pc_file@ Name: lib@CMAKE_PROJECT_NAME@ Description: Library to detect essential performance optimization information about host CPU. -Version: @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@ +Version: URL: @PROJECT_HOMEPAGE_URL@ Libs: -L${libdir} -lcpuinfo Cflags: -I${includedir} |