This is an automated email from the ASF dual-hosted git repository.

bneradt pushed a commit to branch dev-1-2-13
in repository https://gitbox.apache.org/repos/asf/trafficserver-libswoc.git

commit dc9a061350c4d766cfccd0516fb79df695c5cfd5
Author: Alan M. Carroll <[email protected]>
AuthorDate: Wed Oct 28 16:30:39 2020 -0500

    CMake cleanup for better build and install.
---
 .gitignore                    | 29 ++++++++++++++---------------
 CMakeLists.txt                | 12 +-----------
 code/CMakeLists.txt           | 15 +++++++++------
 code/libswoc.pc.cmake         |  2 +-
 doc/{Makefile => MakeDocFile} |  0
 5 files changed, 25 insertions(+), 33 deletions(-)

diff --git a/.gitignore b/.gitignore
index feab391..12b4794 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,17 +1,8 @@
-# Prerequisites
-*.d
-*.cbp
-
 # Compiled Object files
-*.slo
-*.lo
 *.o
 *.obj
 *.swp
-
-# Precompiled Headers
-*.gch
-*.pch
+*.cbp
 
 # Compiled Dynamic libraries
 *.so
@@ -19,8 +10,6 @@
 *.dll
 
 # Compiled Static libraries
-*.lai
-*.la
 *.a
 *.lib
 
@@ -28,16 +17,26 @@
 *.exe
 *.out
 *.app
+example/ex_flat_space
+example/ex_netcompact
+example/ex_netdb
+unit_tests/test_libswoc
 
+# CMake cruft
+*.cmake
+CMakeFiles/
+CMakeCache.txt
+cmake-build-debug/
+cmake-build-release/
+Makefile
 .idea/
-cmake-build-debug
+
+# Documentation.
 doc/_build
 doc/doxygen
 doc/reference
 doc/ext/local-config.py
 doc/ext/__*
-CMakeFiles/
-cmake-build-release/
 venv/
 .parts.cache
 .sconsign.dblite
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0f6a02f..fa6f3a4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.12)
+cmake_minimum_required(VERSION 3.11)
 
 project("Solid Wall Of C++ Library")
 set(INSTALL_DIR ${CMAKE_HOME_DIRECTORY})
@@ -9,13 +9,3 @@ add_subdirectory(unit_tests)
 add_subdirectory(example)
 add_subdirectory(doc EXCLUDE_FROM_ALL)
 
-# Find all of the directories subject to clang formatting and make a target to 
do the format.
-set(_CLANG_DIRS "")
-get_target_property(_TMP libswoc CLANG_FORMAT_DIRS)
-list(APPEND _CLANG_DIRS ${_TMP})
-get_target_property(_TMP test_libswoc CLANG_FORMAT_DIRS)
-list(APPEND _CLANG_DIRS ${_TMP})
-list(JOIN _CLANG_DIRS " " _CLANG_DIRS)
-
-#add_custom_target(clang-format COMMAND 
${CMAKE_HOME_DIRECTORY}/tools/clang-format.sh ${_CLANG_DIRS})
-#add_custom_target(clang-format COMMAND clang-format ${_CLANG_DIRS})
diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt
index b57ad86..40e8695 100644
--- a/code/CMakeLists.txt
+++ b/code/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required(VERSION 3.12)
+cmake_minimum_required(VERSION 3.11)
 
 project(Lib-SWOC CXX)
 set(LIBSWOC_VERSION "1.2.13")
@@ -45,12 +45,13 @@ set(CC_FILES
     )
 
 add_library(libswoc STATIC ${CC_FILES})
+set_target_properties(libswoc PROPERTIES OUTPUT_NAME swoc-static)
 if (CMAKE_COMPILER_IS_GNUCXX)
-    target_compile_options(libswoc PRIVATE -Wall -Wextra -Werror 
-Wnon-virtual-dtor -Wpedantic)
+    target_compile_options(libswoc PRIVATE -fPIC -Wall -Wextra -Werror 
-Wnon-virtual-dtor -Wpedantic)
 endif()
 
 # Not quite sure how this works, but I think it generates one of two paths 
depending on the context.
-# That is, the generator functions return non-empty stri ngs only in the 
corresponding context.
+# That is, the generator functions return non-empty strings only in the 
corresponding context.
 target_include_directories(libswoc
     PUBLIC
         $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
@@ -58,9 +59,10 @@ target_include_directories(libswoc
     )
 
 # These install target variables are created by GNUInstallDirs.
+message("CMAKE_INSTALL_LIBDIR = ${CMAKE_INSTALL_LIBDIR}")
 install(TARGETS libswoc
     EXPORT libswoc-config
-    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+    ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} # seems to have no effect.
     )
 install(DIRECTORY include/swoc DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
 
@@ -69,9 +71,10 @@ install(EXPORT libswoc-config
     DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libswoc
     )
 
-set(PKG_CONFIG_FILE ${CMAKE_BINARY_DIR}/libswoc.pc)
+
+set(PKG_CONFIG_FILE ${CMAKE_INSTALL_LIBDIR}/libswoc.pc)
 configure_file("libswoc.pc.cmake" ${PKG_CONFIG_FILE} @ONLY)
-install(FILES ${PKG_CONFIG_FILE} DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+install(FILES ${PKG_CONFIG_FILE} DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
 
 # Alledgedly this makes the targets "importable from the build directory" but 
I see no evidence of that.
 # AFAICT the file isn't created at all even with this enabled.
diff --git a/code/libswoc.pc.cmake b/code/libswoc.pc.cmake
index 2bd65a1..c65ba62 100644
--- a/code/libswoc.pc.cmake
+++ b/code/libswoc.pc.cmake
@@ -7,5 +7,5 @@ Name: LibSWOC++
 Description: A collection of solid C++ utilities and classes.
 Version: @LIBSWOC_VERSION@
 Requires:
-Libs: -L${libdir} -lswoc++
+Libs: -L${libdir} -lswoc
 Cflags: -I${includedir}
diff --git a/doc/Makefile b/doc/MakeDocFile
similarity index 100%
rename from doc/Makefile
rename to doc/MakeDocFile

Reply via email to