Skip to content
Closed
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
54 changes: 37 additions & 17 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,35 @@ set(__ignore__ ${CMAKE_C_COMPILER})
# Options
#
#-------------------------------------------------
option(BOOST_OPENMETHOD_BUILD_TESTS "Build boost::openmethod tests even if BUILD_TESTING is OFF" OFF)
option(BOOST_OPENMETHOD_BUILD_EXAMPLES "Build boost::openmethod examples" ${BOOST_OPENMETHOD_IS_ROOT})
option(BOOST_OPENMETHOD_MRDOCS_BUILD "Build the target for MrDocs: see mrdocs.yml" OFF)
option(BOOST_OPENMETHOD_WARNINGS_AS_ERRORS "Treat warnings as errors" OFF)

option(
BOOST_OPENMETHOD_BUILD_TESTS
"Build boost::openmethod tests even if BUILD_TESTING is OFF"
Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The option description is now misleading. The option no longer allows building tests "even if BUILD_TESTING is OFF" because lines 46-48 force BOOST_OPENMETHOD_BUILD_TESTS to ON when BUILD_TESTING is ON. The description should be updated to accurately reflect that this option enables tests by default when the project is root, but is overridden to ON when BUILD_TESTING is ON.

Suggested change
"Build boost::openmethod tests even if BUILD_TESTING is OFF"
"Enable boost::openmethod tests by default when this is the root project; always ON if BUILD_TESTING is ON"

Copilot uses AI. Check for mistakes.
${BOOST_OPENMETHOD_IS_ROOT})

if (BUILD_TESTING)
set(BOOST_OPENMETHOD_BUILD_TESTS ON)
endif ()

option(
BOOST_OPENMETHOD_BUILD_EXAMPLES
"Build boost::openmethod examples"
${BOOST_OPENMETHOD_IS_ROOT})
option(
BOOST_OPENMETHOD_MRDOCS_BUILD
"Build the target for MrDocs: see mrdocs.yml"
OFF)
option(
BOOST_OPENMETHOD_WARNINGS_AS_ERRORS
"Treat warnings as errors"
OFF)

if (BOOST_OPENMETHOD_BUILD_EXAMPLES AND NOT BOOST_OPENMETHOD_BUILD_TESTS)
message(
WARNING
"BOOST_OPENMETHOD_BUILD_EXAMPLES requires BOOST_OPENMETHOD_BUILD_TESTS. Examples will not be built.")
set(BOOST_OPENMETHOD_BUILD_EXAMPLES OFF)
endif()
Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent spacing in endif statement. Line 68 uses endif() without a space, while line 213 (also newly added in this PR) uses endif () with a space. Consider standardizing on one style throughout the file for consistency.

Suggested change
endif()
endif ()

Copilot uses AI. Check for mistakes.

# Check if environment variable BOOST_SRC_DIR is set
if (NOT DEFINED BOOST_SRC_DIR AND DEFINED ENV{BOOST_SRC_DIR})
Expand Down Expand Up @@ -77,9 +102,9 @@ endforeach ()
if (NOT BOOST_OPENMETHOD_MRDOCS_BUILD)
if (BUILD_TESTING OR BOOST_OPENMETHOD_BUILD_TESTS)
Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The condition BUILD_TESTING OR BOOST_OPENMETHOD_BUILD_TESTS is redundant. Since lines 46-48 ensure that BOOST_OPENMETHOD_BUILD_TESTS is ON whenever BUILD_TESTING is ON, checking BUILD_TESTING separately is unnecessary. Consider simplifying this to just check BOOST_OPENMETHOD_BUILD_TESTS for better maintainability.

Suggested change
if (BUILD_TESTING OR BOOST_OPENMETHOD_BUILD_TESTS)
if (BOOST_OPENMETHOD_BUILD_TESTS)

Copilot uses AI. Check for mistakes.
set(BOOST_OPENMETHOD_UNIT_TEST_LIBRARIES test)
endif()
if (BOOST_OPENMETHOD_BUILD_EXAMPLES)
set(BOOST_OPENMETHOD_EXAMPLE_LIBRARIES dll)
if (BOOST_OPENMETHOD_BUILD_EXAMPLES)
set(BOOST_OPENMETHOD_EXAMPLE_LIBRARIES dll)
endif()
Copy link

Copilot AI Dec 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent spacing in endif statement. Line 107 uses endif() without a space, while line 213 (also newly added in this PR) uses endif () with a space. Consider standardizing on one style throughout the file for consistency.

Suggested change
endif()
endif ()

Copilot uses AI. Check for mistakes.
endif()
endif()
# Complete dependency list
Expand Down Expand Up @@ -175,20 +200,15 @@ endif()
# Tests
#
#-------------------------------------------------
if (BUILD_TESTING OR BOOST_OPENMETHOD_BUILD_TESTS)
if (BOOST_OPENMETHOD_BUILD_TESTS)
enable_testing()
add_subdirectory(test)
if (BOOST_OPENMETHOD_IS_ROOT)
add_custom_target(all_with_tests ALL DEPENDS tests)
endif()
endif ()

#-------------------------------------------------
#
# Examples
#
#-------------------------------------------------
if (BOOST_OPENMETHOD_BUILD_EXAMPLES)
enable_testing()
add_subdirectory(doc/modules/ROOT/examples)
# Examples
if (BOOST_OPENMETHOD_BUILD_EXAMPLES)
add_subdirectory(doc/modules/ROOT/examples)
endif ()
endif ()
Loading