Skip to content

Commit

Permalink
add workflow for mac os
Browse files Browse the repository at this point in the history
fix: use LINK_LIBRARIES instead of LIBRARIES (fixed library search path on Mac OS)
  • Loading branch information
falk-werner committed Nov 17, 2023
1 parent ad065e3 commit 283cdad
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 5 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/build-maxos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Mac OS Build

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:

build:
runs-on: macos-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install dependencies
run: brew install openssl cmake googletest

- name: Configure
run: |
cmake -B build
- name: Build
run: |
cmake --build build
- name: Unit Test
run: |
cmake --build build --target test
# - name: Memcheck
# working-directory: build
# run: |
# valgrind --error-exitcode=1 ./alltests

8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ add_library(openssl++ STATIC
lib/openssl++/certificate_stack.cc
lib/openssl++/cms.cc
)
target_include_directories(openssl++ PRIVATE lib include)
target_include_directories(openssl++ PUBLIC lib include ${OPENSSL_INCLUDE_DIRS})
target_compile_options(openssl++ PUBLIC ${OPENSSL_CFLAGS_OTHER})
target_link_libraries(openssl++ PUBLIC ${OPENSSL_LIBRARIES})
target_link_libraries(openssl++ PUBLIC ${OPENSSL_LINK_LIBRARIES})

add_library(zipsign STATIC
lib/zipsign/file.cc
Expand Down Expand Up @@ -115,8 +115,8 @@ target_include_directories(alltests PRIVATE
)

target_link_libraries(alltests PRIVATE zipsign)
target_compile_options(alltests PRIVATE ${GMOCK_CFLAGS} ${GTEST_CFLAGS} "-pthread")
target_link_libraries(alltests PRIVATE zipsign cli ${GMOCK_LIBRARIES} ${GTEST_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
target_compile_options(alltests PRIVATE ${GMOCK_CFLAGS} ${GTEST_CFLAGS} "-pthread" "-Wno-sign-compare")
target_link_libraries(alltests PRIVATE zipsign cli ${GMOCK_LINK_LIBRARIES} ${GTEST_LINK_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})

add_custom_command(TARGET alltests PRE_BUILD
COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/test/openssl/create-pki.sh ${CMAKE_CURRENT_SOURCE_DIR}/test/openssl
Expand Down
2 changes: 1 addition & 1 deletion lib/cli/default_arguments.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ std::vector<std::string> const & DefaultArguments::getList(char id) const
auto it = values.find(id);
if (values.end() == it)
{
throw std::out_of_range("id not found : " + id);
throw std::out_of_range("id not found : " + std::string(1, id));
}

return it->second;
Expand Down

0 comments on commit 283cdad

Please sign in to comment.