Skip to content

Make common CMake targets more modular#53

Merged
saki7 merged 1 commit intomainfrom
fix-common-targets
Mar 12, 2026
Merged

Make common CMake targets more modular#53
saki7 merged 1 commit intomainfrom
fix-common-targets

Conversation

@saki7
Copy link
Member

@saki7 saki7 commented Mar 12, 2026

During transition of my non-iris project, I found that ASan related flags are not quite usable in certain scenario. In game projects, we have to link our library to the game engine SDK that is built with some preconfigured flags, which makes it often not that easy to "just enable ASan everywhere".

Ideally, we should split test-related common targets (i.e. iris_cxx_test iris_cxx_test_external) into two variations: sanitizer-enabled version and disabled version. However, that requires a lot of work to implement because the normal CMake dependencies added by FetchContent (e.g. Catch2) cannot be duplicated, because their targets are defined inside their own hard-coded CMake namespace (e.g. Catch2::Catch2).

In order to do the complete fix, I think we need to use ExternalProject_Add (instead of FetchContent) and build two versions of all dependent libraries. That should be addressed in a future PR.

This PR adds a new option IRIS_TEST_USE_SANITIZER (defaulted to ON). Users may turn it OFF to globally disable sanitizer in non-sanitizer-applicable projects.

@saki7 saki7 self-assigned this Mar 12, 2026
@saki7 saki7 added enhancement New feature or request CI Build system issues labels Mar 12, 2026
@cppwarningnotifier
Copy link

EnvironmentC++23C++26
irisClang21Debug✅success✅success
Release✅success✅success
GCC14Debug✅success✅success
Release✅success✅success
MSVC2022Debug✅success✅success
Release✅success✅success
2026Debug✅success✅success
Release✅success✅success

@saki7 saki7 merged commit 8104bf7 into main Mar 12, 2026
34 checks passed
@saki7 saki7 deleted the fix-common-targets branch March 12, 2026 14:03
saki7 added a commit to iris-cpp/x4 that referenced this pull request Mar 12, 2026
Companion PR for iris-cpp/iris#53
@saki7 saki7 mentioned this pull request Mar 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Build system issues enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant