This is an automated email from the ASF dual-hosted git repository. bneradt pushed a commit to branch win-compat in repository https://gitbox.apache.org/repos/asf/trafficserver-libswoc.git
commit 8f0d4cfdcfb5e9218da060112bef7611af546ea6 Author: Alan M. Carroll <[email protected]> AuthorDate: Tue Apr 21 07:49:18 2020 -0500 Fixes for MS compatibility. --- .idea/codeStyles/codeStyleConfig.xml | 2 +- CMakeLists.txt | 2 +- example/CMakeLists.txt | 4 +++- swoc++/CMakeLists.txt | 30 +++++++++++++------------ swoc++/{libswoc++.pc.cmake => libswoc.pc.cmake} | 0 unit_tests/CMakeLists.txt | 5 ++++- 6 files changed, 25 insertions(+), 18 deletions(-) diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml index a55e7a1..79ee123 100644 --- a/.idea/codeStyles/codeStyleConfig.xml +++ b/.idea/codeStyles/codeStyleConfig.xml @@ -1,5 +1,5 @@ <component name="ProjectCodeStyleConfiguration"> <state> - <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" /> + <option name="USE_PER_PROJECT_SETTINGS" value="true" /> </state> </component> \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 518ba09..e9b8cae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ 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 swoc++ CLANG_FORMAT_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}) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 07394ab..37e987a 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -8,4 +8,6 @@ add_executable(ex_netdb target_link_libraries(ex_netdb PUBLIC swoc++) set_target_properties(ex_netdb PROPERTIES CLANG_FORMAT_DIRS ${CMAKE_CURRENT_SOURCE_DIR}) -target_compile_options(ex_netdb PRIVATE -Wall -Wextra -Werror -Wno-unused-parameter -Wno-format-truncation -Wno-stringop-overflow -Wno-invalid-offsetof) +if(UNIX) + target_compile_options(ex_netdb PRIVATE -Wall -Wextra -Werror -Wno-unused-parameter -Wno-format-truncation -Wno-stringop-overflow -Wno-invalid-offsetof) +endif() diff --git a/swoc++/CMakeLists.txt b/swoc++/CMakeLists.txt index 6c9982f..f91a7ea 100644 --- a/swoc++/CMakeLists.txt +++ b/swoc++/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.12) -project(lib-swoc++ CXX) -set(LIBSWOC_VERSION "1.2.0") +project(lib-SWOC CXX) +set(LIBSWOC_VERSION "1.2.1") set(CMAKE_CXX_STANDARD 17) include(GNUInstallDirs) @@ -44,38 +44,40 @@ set(CC_FILES src/TextView.cc ) -add_library(swoc++ STATIC ${CC_FILES}) +add_library(libswoc STATIC ${CC_FILES}) #add_compile_options(-Wall -Wextra -Werror -Wno-unused-parameter -Wno-format-truncation -Wno-stringop-overflow -Wno-invalid-offsetof) -target_compile_options(swoc++ PRIVATE -Wall -Wextra -Werror -Wnon-virtual-dtor -Wno-unused-parameter -Wno-stringop-overflow) +if(UNIX) + target_compile_options(libswoc PRIVATE -Wall -Wextra -Werror -Wnon-virtual-dtor) +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 strings only in the corresponding context. -target_include_directories(swoc++ +target_include_directories(libswoc PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> ) # These install target variables are created by GNUInstallDirs. -install(TARGETS swoc++ - EXPORT swoc++-config +install(TARGETS libswoc + EXPORT libswoc-config ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) install(DIRECTORY include/swoc DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -install(EXPORT swoc++-config - NAMESPACE swoc++:: - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/swoc++ +install(EXPORT libswoc-config + NAMESPACE libswoc:: + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libswoc ) -set(PKG_CONFIG_FILE ${CMAKE_BINARY_DIR}/libswoc++.pc) -configure_file("libswoc++.pc.cmake" ${PKG_CONFIG_FILE} @ONLY) +set(PKG_CONFIG_FILE ${CMAKE_BINARY_DIR}/libswoc.pc) +configure_file("libswoc.pc.cmake" ${PKG_CONFIG_FILE} @ONLY) install(FILES ${PKG_CONFIG_FILE} DESTINATION ${LIB_INSTALL_DIR}/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. -#export(TARGETS swoc++ FILE libswoc++-config.cmake) +#export(TARGETS libswoc FILE libswoc-config.cmake) set(CLANG_DIRS ) -set_target_properties(swoc++ PROPERTIES CLANG_FORMAT_DIRS "${PROJECT_SOURCE_DIR}/src;${PROJECT_SOURCE_DIR}/include") +set_target_properties(libswoc PROPERTIES CLANG_FORMAT_DIRS "${PROJECT_SOURCE_DIR}/src;${PROJECT_SOURCE_DIR}/include") diff --git a/swoc++/libswoc++.pc.cmake b/swoc++/libswoc.pc.cmake similarity index 100% rename from swoc++/libswoc++.pc.cmake rename to swoc++/libswoc.pc.cmake diff --git a/unit_tests/CMakeLists.txt b/unit_tests/CMakeLists.txt index 88f949a..c958348 100644 --- a/unit_tests/CMakeLists.txt +++ b/unit_tests/CMakeLists.txt @@ -28,5 +28,8 @@ add_executable(test_libswoc target_link_libraries(test_libswoc PUBLIC swoc++) set_target_properties(test_libswoc PROPERTIES CLANG_FORMAT_DIRS ${CMAKE_CURRENT_SOURCE_DIR}) -target_compile_options(test_libswoc PRIVATE -Wall -Wextra -Werror -Wno-unused-parameter -Wno-format-truncation -Wno-stringop-overflow -Wno-invalid-offsetof) +if(UNIX) + target_compile_options(test_libswoc PRIVATE -Wall -Wextra -Werror -Wno-unused-parameter -Wno-format-truncation -Wno-stringop-overflow -Wno-invalid-offsetof) +endif() + #add_definitions(-DVERBOSE_EXAMPLE_OUTPUT=1)
