Skip to content

Commit b5544b9

Browse files
authored
CMake: Explicit link interface management (#27)
1 parent ea6e6bf commit b5544b9

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,18 +114,13 @@ jobs:
114114
uses: lukka/run-vcpkg@v2
115115
with:
116116
vcpkgGitCommitId: ${{ env.vcpkg-commit }}
117-
vcpkgArguments: ${{ env.vcpkg-install }}
118-
119-
- name: deps
120-
run: |
121-
brew install openssl
117+
vcpkgArguments: ${{ env.vcpkg-install }} openssl
122118

123119
- name: configure
124120
run: |
125121
mkdir build && cd build
126122
cmake \
127123
-DCMAKE_TOOLCHAIN_FILE=$VCPKG_ROOT/scripts/buildsystems/vcpkg.cmake \
128-
-DOPENSSL_ROOT_DIR=/usr/local/opt/openssl@1.1 \
129124
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }} \
130125
-DBUILD_SHARED_LIBS=${{ matrix.build-shared.flag }} \
131126
-DBUILD_SVCLI=1 \

src/CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ add_library("${PROJECT_NAME}" uthenticode.cpp)
1212

1313
if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
1414
if (MSVC)
15-
target_compile_options("${PROJECT_NAME}" PUBLIC /W4 /WX)
15+
target_compile_options("${PROJECT_NAME}" INTERFACE /W4 /WX)
1616
else ()
17-
target_compile_options("${PROJECT_NAME}" PUBLIC -Wall -Wextra -pedantic -Werror)
18-
target_compile_options("${PROJECT_NAME}" PUBLIC -fsanitize=address)
19-
target_link_options("${PROJECT_NAME}" PUBLIC -fsanitize=address)
17+
target_compile_options("${PROJECT_NAME}" INTERFACE -Wall -Wextra -pedantic -Werror)
18+
target_compile_options("${PROJECT_NAME}" INTERFACE -fsanitize=address)
19+
target_link_libraries("${PROJECT_NAME}" INTERFACE -fsanitize=address)
2020
endif ()
2121
endif ()
2222

@@ -29,8 +29,8 @@ target_include_directories(
2929
# even when set explicitly as PUBLIC. We set it here so that it works correctly in the install step.
3030
set_target_properties("${PROJECT_NAME}" PROPERTIES PUBLIC_HEADER "include/uthenticode.h")
3131

32-
target_link_libraries("${PROJECT_NAME}" pe-parse::pe-parser-library)
33-
target_link_libraries("${PROJECT_NAME}" OpenSSL::Crypto)
32+
target_link_libraries("${PROJECT_NAME}" PUBLIC pe-parse::pe-parser-library)
33+
target_link_libraries("${PROJECT_NAME}" PRIVATE "${OPENSSL_CRYPTO_LIBRARY}")
3434

3535
install(
3636
TARGETS "${PROJECT_NAME}"

0 commit comments

Comments
 (0)