diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 7e5701c..4840290 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -19,6 +19,7 @@ jobs: matrix: external-gtest: [ YES, NO ] os: [ ubuntu-latest, ubuntu-22.04 ] + asan: [ YES, NO ] runs-on: ${{ matrix.os }} name: Build with external_gtest=${{ matrix.external-gtest }} on ${{ matrix.os }} @@ -44,7 +45,7 @@ jobs: # Note the current convention is to use the -S and -B options here to specify source # and build directories, but this is only available with CMake 3.13 and higher. # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSCITOKENS_BUILD_UNITTESTS=yes -DSCITOKENS_EXTERNAL_GTEST=${{ matrix.external-gtest }} + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DSCITOKENS_BUILD_UNITTESTS=yes -DSCITOKENS_EXTERNAL_GTEST=${{ matrix.external-gtest }} -DSCITOKENS_WITH_ASAN=${{ matrix.asan }} - name: Build working-directory: ${{runner.workspace}}/build diff --git a/CMakeLists.txt b/CMakeLists.txt index 688a2d0..b3e3c55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,8 +6,9 @@ project( scitokens-cpp VERSION 1.0.2 LANGUAGES CXX) -option( SCITOKENS_BUILD_UNITTESTS "Build the scitokens-cpp unit tests" OFF ) -option( SCITOKENS_EXTERNAL_GTEST "Use an external/pre-installed copy of GTest" OFF ) +option( SCITOKENS_BUILD_UNITTESTS "Build the scitokens-cpp unit tests" ON ) +option( SCITOKENS_EXTERNAL_GTEST " Use an external/pre-installed copy of GTest" OFF ) +option( SCITOKENS_WITH_ASAN "Build with the address santizier" OFF ) set( CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}" ) @@ -15,6 +16,11 @@ set( CMAKE_BUILD_TYPE RelWithDebInfo) # -g -O2 set( CMAKE_UNITY_BUILD False) +if( SCITOKENS_WITH_ASAN ) + add_compile_options(-fsanitize=address -fno-omit-frame-pointer) + add_link_options(-fsanitize=address) +endif() + include(GNUInstallDirs) find_package( jwt-cpp REQUIRED )