Adds top-level CMake build (T-04): static JTest lib, example, ctest smoke #1

Merged
maj merged 1 commits from t01-cmake-build into develop 2026-09-28 06:55:17 +00:00
Owner

The project was Makefile-only and non-portable. Adds a top-level
CMakeLists.txt so the framework builds with a standard build system:

  • add_library(JTest STATIC ...) over the 13 src/JTest/*.cpp translation
    units. No find_package/FetchContent is needed: a full #include scan of
    include/, src/, examples/ shows the framework depends only on the C++
    standard library plus its own <JTest/...> headers.
  • target_include_directories(JTest PUBLIC include) so consumers that link
    JTest (the example, tests) inherit the include path transitively.
  • target_compile_features(JTest PUBLIC cxx_std_17) propagates the C++17
    requirement (sources use std::optional).
  • Portable (no -arch) build: the Makefile's non-portable -arch flag is not
    carried over (that is T-20's scope).
  • enable_testing() + add_test() running tests/smoke.cpp, a genuine self-check
    that exercises the public API and exits non-zero on any failed assertion, so
    ctest is a real pass/fail gate. The demo example remains a build/run target
    but is intentionally excluded from the CTest gate (it contains deliberate
    failing/skipping cases to showcase reporting and always exits 0).

Verified end-to-end (CMake 4.4.3, AppleClang 21, out-of-source build):
configure OK, builds libJTest.a + example + test_smoke, ctest passes
(smoke: Passed, 100%), example demo runs.

The project was Makefile-only and non-portable. Adds a top-level CMakeLists.txt so the framework builds with a standard build system: * add_library(JTest STATIC ...) over the 13 src/JTest/*.cpp translation units. No find_package/FetchContent is needed: a full #include scan of include/, src/, examples/ shows the framework depends only on the C++ standard library plus its own <JTest/...> headers. * target_include_directories(JTest PUBLIC include) so consumers that link JTest (the example, tests) inherit the include path transitively. * target_compile_features(JTest PUBLIC cxx_std_17) propagates the C++17 requirement (sources use std::optional). * Portable (no -arch) build: the Makefile's non-portable -arch flag is not carried over (that is T-20's scope). * enable_testing() + add_test() running tests/smoke.cpp, a genuine self-check that exercises the public API and exits non-zero on any failed assertion, so ctest is a real pass/fail gate. The demo example remains a build/run target but is intentionally excluded from the CTest gate (it contains deliberate failing/skipping cases to showcase reporting and always exits 0). Verified end-to-end (CMake 4.4.3, AppleClang 21, out-of-source build): configure OK, builds libJTest.a + example + test_smoke, ctest passes (smoke: Passed, 100%), example demo runs.
maj added 1 commit 2026-09-28 06:55:09 +00:00
The project was Makefile-only and non-portable. Adds a top-level
CMakeLists.txt so the framework builds with a standard build system:

* add_library(JTest STATIC ...) over the 13 src/JTest/*.cpp translation
  units. No find_package/FetchContent is needed: a full #include scan of
  include/, src/, examples/ shows the framework depends only on the C++
  standard library plus its own <JTest/...> headers.
* target_include_directories(JTest PUBLIC include) so consumers that link
  JTest (the example, tests) inherit the include path transitively.
* target_compile_features(JTest PUBLIC cxx_std_17) propagates the C++17
  requirement (sources use std::optional).
* Portable (no -arch) build: the Makefile's non-portable -arch flag is not
  carried over (that is T-20's scope).
* enable_testing() + add_test() running tests/smoke.cpp, a genuine self-check
  that exercises the public API and exits non-zero on any failed assertion, so
  ctest is a real pass/fail gate. The demo example remains a build/run target
  but is intentionally excluded from the CTest gate (it contains deliberate
  failing/skipping cases to showcase reporting and always exits 0).

Verified end-to-end (CMake 4.4.3, AppleClang 21, out-of-source build):
configure OK, builds libJTest.a + example + test_smoke, ctest passes
(smoke: Passed, 100%), example demo runs.
maj merged commit a089557df7 into develop 2026-09-28 06:55:17 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: maj/JTest#1