@@ -111,8 +111,8 @@ if(PROJECT_IS_TOP_LEVEL AND NOT CPM_SOURCE_CACHE AND NOT DEFINED ENV{CPM_SOURCE_
111111endif()
112112include(cmake/CPM.cmake)
113113
114- # Fetch cpp-library via CPM
115- CPMAddPackage("gh:stlab/cpp-library@4.0.3")
114+ # Fetch cpp-library via CPM (update to latest version)
115+ CPMAddPackage("gh:stlab/cpp-library@4.0.3") # Check for latest version
116116include(${cpp-library_SOURCE_DIR}/cpp-library.cmake)
117117
118118cpp_library_setup(
@@ -358,9 +358,9 @@ To enable automatic documentation deployment to GitHub Pages:
358358
3593591 . Go to your repository ** Settings** → ** Pages**
3603602 . Under ** Source** , select ** GitHub Actions**
361- 3 . Push a commit to trigger the CI workflow
361+ 3 . Publish a release to trigger documentation build
362362
363- Your documentation will be automatically built and deployed to ` https://your-org.github.io/your-library/ ` on every push to the main branch .
363+ Your documentation will be automatically built and deployed to ` https://your-org.github.io/your-library/ ` when you publish a GitHub release .
364364
365365## API Reference
366366
@@ -410,21 +410,6 @@ This produces:
410410- ** Target alias** : ` stlab::enum-ops ` (used in ` target_link_libraries() ` )
411411- ** Repository name** : ` stlab/stlab-enum-ops ` (must match package name)
412412
413- ** Alternative Patterns:**
414-
415- You can also use ` project(namespace-component) ` - the namespace prefix will be detected and stripped from the target alias:
416-
417- ``` cmake
418- project(stlab-enum-ops) # Includes namespace prefix
419-
420- cpp_library_setup(
421- NAMESPACE stlab
422- # ...
423- )
424- ```
425-
426- Produces the same result as above.
427-
428413** Special case** — single-component namespace (e.g., ` project(stlab) ` with ` NAMESPACE stlab ` ):
429414
430415- Target name: ` stlab `
@@ -617,6 +602,49 @@ See these projects using cpp-library:
617602
618603Note: Repository names include the namespace prefix for CPM compatibility and collision prevention.
619604
605+ ## Troubleshooting
606+
607+ ### Version Detection Fails
608+
609+ ** Problem** : Error message: "Cannot determine version for dependency..."
610+
611+ ** Solution** : Add explicit version mapping before ` cpp_library_setup() ` :
612+ ``` cmake
613+ cpp_library_map_dependency("stlab::enum-ops" "stlab-enum-ops 1.0.0")
614+ ```
615+
616+ The error message shows the exact line to add.
617+
618+ ### Non-Namespaced Target Error
619+
620+ ** Problem** : "Cannot automatically handle non-namespaced dependency: opencv_core"
621+
622+ ** Solution** : Non-namespaced targets must be explicitly mapped:
623+ ``` cmake
624+ cpp_library_map_dependency("opencv_core" "OpenCV 4.5.0")
625+ ```
626+
627+ ### Component Merging Not Working
628+
629+ ** Problem** : Multiple Qt/Boost components generate separate ` find_dependency() ` calls
630+
631+ ** Solution** : Ensure all components have ** identical** package name, version, and additional arguments:
632+ ``` cmake
633+ # ✓ Correct - will merge
634+ cpp_library_map_dependency("Qt6::Core" "Qt6 6.5.0 COMPONENTS Core")
635+ cpp_library_map_dependency("Qt6::Widgets" "Qt6 6.5.0 COMPONENTS Widgets")
636+
637+ # ✗ Wrong - won't merge (different versions)
638+ cpp_library_map_dependency("Qt6::Core" "Qt6 6.5.0 COMPONENTS Core")
639+ cpp_library_map_dependency("Qt6::Widgets" "Qt6 6.4.0 COMPONENTS Widgets")
640+ ```
641+
642+ ### CPM Cannot Find Package
643+
644+ ** Problem** : ` CPMAddPackage("gh:stlab/enum-ops@1.0.0") ` fails with ` CPM_USE_LOCAL_PACKAGES `
645+
646+ ** Solution** : Repository name must match package name. If package name is ` stlab-enum-ops ` , repository must be ` stlab/stlab-enum-ops ` , not ` stlab/enum-ops ` .
647+
620648## Development
621649
622650### Running Tests
0 commit comments