Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
cpp11: [0, 1]
steps:
- uses: actions/checkout@v3
- run: make test WARN=1
- run: cmake ./ && make test
env:
CC: ${{ matrix.compiler }}
CPP11: ${{ matrix.cpp11 }}
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- run: make test WARN=1
- run: cmake ./ && make test
29 changes: 29 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
cmake_minimum_required(VERSION 3.18)

project(cpp-optparse)

set(CMAKE_CXX_STANDARD 11)

if ((CMAKE_CXX_COMPILER_ID MATCHES GNU) OR (CMAKE_CXX_COMPILER_ID MATCHES Clang))
set(CMAKE_CXX_FLAGS "-O3 -g -Wall -Wextra -Werror")
# Not sure if these flags still apply to IntelLLVM
elseif (CMAKE_CXX_COMPILER_ID MATCHES Intel)
set(CMAKE_CXX_FLAGS "-O3 -ipo -g -Wall -wd981 -wd383 -wd2259 -Werror")
endif()

add_library(cpp-optparse OptionParser.cpp OptionParser.h)

add_executable(testprog testprog.cpp)

target_link_libraries(testprog cpp-optparse)

enable_testing()
add_test(NAME Test COMMAND testprog "${CMAKE_SOURCE_DIR}/test.sh")

include(GNUInstallDirs)

configure_file("pkg-config.pc.in" "cpp-optparse.pc" @ONLY)

install(TARGETS cpp-optparse)
install(FILES OptionParser.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/")
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/cpp-optparse.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
30 changes: 0 additions & 30 deletions Makefile

This file was deleted.

9 changes: 9 additions & 0 deletions pkg-config.pc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
prefix=@CMAKE_INSTALL_PREFIX@
libdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@
includedir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_INCLUDEDIR@

Name: cpp-optparse
Description: Python's excellent OptionParser in C++
Version: 1.0
Libs: -L${libdir} -lcpp-optparse
Cflags: -I${includedir}