Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor Cleanup #468

Merged
merged 2 commits into from
Dec 3, 2023
Merged
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
33 changes: 3 additions & 30 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,42 +10,15 @@ project(Corrosion
HOMEPAGE_URL "https://corrosion-rs.github.io/corrosion/"
)

# Default behavior:
# - If the project is being used as a subdirectory, then don't build tests and
# don't enable any languages.
# - If this is a top level project, then build tests and enable the C++ compiler
if (NOT CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set(_CORROSION_TOP_LEVEL OFF)
else()
set(_CORROSION_TOP_LEVEL ON)
endif()

# ==== Corrosion Configuration ====

option(
CORROSION_BUILD_TESTS
"Build Corrosion test project"
${_CORROSION_TOP_LEVEL}
)

set(
CORROSION_GENERATOR_EXECUTABLE CACHE STRING
"Use prebuilt, non-bootstrapped corrosion-generator")
mark_as_advanced(CORROSION_GENERATOR_EXECUTABLE)

option(
CORROSION_INSTALL_EXECUTABLE
"Controls whether corrosion-generator is installed with the package"
${CORROSION_INSTALL_EXECUTABLE_DEFAULT}
${PROJECT_IS_TOP_LEVEL}
)
mark_as_advanced(CORROSION_INSTALL_EXECUTABLE)

if (CORROSION_GENERATOR_EXECUTABLE OR CORROSION_INSTALL_EXECUTABLE)
message(FATAL_ERROR "The Cache variables CORROSION_GENERATOR_EXECUTABLE CORROSION_INSTALL_EXECUTABLE"
" were removed.")
endif()

if (_CORROSION_TOP_LEVEL)
if (PROJECT_IS_TOP_LEVEL)
# We need to enable a language for corrosions test to work.
# For projects using corrosion this is not needed
enable_language(C)
Expand All @@ -66,7 +39,7 @@ if (CORROSION_BUILD_TESTS)
endif()

# If Corrosion is a subdirectory, do not enable its install code
if (NOT _CORROSION_TOP_LEVEL)
if (NOT PROJECT_IS_TOP_LEVEL)
return()
endif()

Expand Down