1
0
Fork 0
mirror of https://github.com/TheLartians/ModernCppStarter.git synced 2025-08-30 21:51:12 +02:00

Do NOT set visibility to hidden for all targets

only if requested and only for our target

use clang-tidy too on CI on cmacos
This commit is contained in:
ClausKlein 2021-03-02 11:55:41 +01:00
parent 1b3755e6e5
commit a50af55582
7 changed files with 26 additions and 16 deletions

View file

@ -6,7 +6,7 @@ clang-analyzer-*,\
cppcoreguidelines-*,\
-cppcoreguidelines-macro-usage,\
-cppcoreguidelines-owning-memory,\
-hicpp-*,\
hicpp-*,\
misc-*,\
-misc-non-private-member-variables-in-classes,\
-modernize-*,\

View file

@ -37,3 +37,7 @@ jobs:
run: |
cd build
ctest --build-config Debug
- name: build standalone with clang-tidy
run: |
cmake -S standalone -B build/standalone -DUSE_STATIC_ANALYZER=clang-tidy

View file

@ -4,9 +4,11 @@ name: Standalone
on:
push:
branches:
- master
- develop
pull_request:
branches:
- master
- develop
env:

View file

@ -52,18 +52,25 @@ file(GLOB_RECURSE sources CONFIGURE_DEPENDS source/*.cpp)
add_library(Greeter ${headers} ${sources})
set_target_properties(Greeter PROPERTIES CXX_STANDARD ${CMAKE_CXX_STANDARD})
# for SameMajorVersion upgrade stategie
set_target_properties(Greeter PROPERTIES SOVERSION 1 VERSION ${PROJECT_VERSION})
# Note: for SameMajorVersion upgrade stategie
set_target_properties(
Greeter
PROPERTIES SOVERSION 1
VERSION ${PROJECT_VERSION}
VISIBILITY_INLINES_HIDDEN ${BUILD_SHARED_LIBS}
CMAKE_VISIBILITY_INLINES_HIDDEN ${BUILD_SHARED_LIBS}
)
# being a cross-platform target, we enforce standards conformance on MSVC
target_compile_options(Greeter PUBLIC "$<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/permissive>")
target_compile_options(Greeter PUBLIC $<$<COMPILE_LANG_AND_ID:CXX,MSVC>:/permissive>)
# Link dependencies, but Note: the fmt lib does not work with SHARED yet! CK
target_link_libraries(Greeter PUBLIC fmt::fmt-header-only)
# Link dependencies
target_link_libraries(Greeter PUBLIC $<BUILD_INTERFACE:fmt::fmt-header-only>)
# XXX target_link_libraries(Greeter PUBLIC fmt::fmt)
set(INCLUDE_INSTALL_DIR include/${PROJECT_NAME}-${PROJECT_VERSION})
target_include_directories(
Greeter BEFORE PUBLIC $<BUILD_INTERFACE: ${PROJECT_SOURCE_DIR}/include>
Greeter BEFORE PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>
)
@ -89,7 +96,7 @@ packageProject(
BINARY_DIR ${PROJECT_BINARY_DIR}
INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include
INCLUDE_DESTINATION ${INCLUDE_INSTALL_DIR}
VERSION_HEADER "${VERSION_HEADER_LOCATION}"
VERSION_HEADER ${VERSION_HEADER_LOCATION}
COMPATIBILITY SameMajorVersion
DEPENDENCIES "fmt 7.1.3"
# XXX DEPENDENCIES "fmt 7.1.3"
)

View file

@ -44,7 +44,7 @@ test: install
# all together
all: test
cmake -S $@ -B build/$@ -G "${GENERATOR}" -DCMAKE_PREFIX_PATH=${ROOT} -DTEST_INSTALLED_VERSION=1 -DENABLE_TEST_COVERAGE=1
cmake -S $@ -B build/$@ -G "${GENERATOR}" -DCMAKE_PREFIX_PATH=${ROOT} -DTEST_INSTALLED_VERSION=1 -DENABLE_TEST_COVERAGE=1 -DUSE_STATIC_ANALYZER=clang-tidy
cmake --build build/$@
cmake --build build/$@ --target test
cmake --build build/$@ --target check-format
@ -66,4 +66,5 @@ standalone:
# check the library
check: standalone
run-clang-tidy.py -p build/standalone -checks='-*,modernize-*,misc-*,hicpp-*,cert-*,readability-*,portability-*,performance-*,google-*' standalone
run-clang-tidy.py -p build/standalone standalone
# TODO builddriver run-clang-tidy.py -p build/standalone -checks='-*,modernize-*,misc-*,hicpp-*,cert-*,readability-*,portability-*,performance-*,google-*' standalone

View file

@ -1,4 +1,4 @@
set(CPM_DOWNLOAD_VERSION 0.31.0)
set(CPM_DOWNLOAD_VERSION 0.31.1)
if(CPM_SOURCE_CACHE)
# Expand relative path. This is important if the provided path contains a tilde (~)

View file

@ -5,10 +5,6 @@ endif()
option(BUILD_SHARED_LIBS "Create shared libraries" YES)
# Set default visibility to hidden for all targets
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN YES)
# build the dynamic libraries and executables together at bin directory
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)