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

Create a CMake macro to handle project specific options #1282

Open
white238 opened this issue Dec 4, 2024 · 2 comments
Open

Create a CMake macro to handle project specific options #1282

white238 opened this issue Dec 4, 2024 · 2 comments

Comments

@white238
Copy link
Member

white238 commented Dec 4, 2024

cmake_dependent_option just doesn't work like I always think it should so we should create our own called serac_project_specific_option that encapsulates the behavior we want.

For example:

  • ENABLE_BENCHMARKS is a global BLT created option, it is used for multiple projects. Allow a user to turn that on and honor it
  • Unless the project specific one is set SERAC_ENABLE_BENCHMARKS then honor that one.
  • Always create a SERAC_ENABLE_BENCHMARKS because the rest of our build system is guarded on that
@chapman39
Copy link
Collaborator

personally i like the way cmake_dependent_option works. pretty much, you can't set the project-specific option without ensuring the general one is true. so if you want to enable benchmarks, we should just set ENABLE_BENCHMARKS. it will automatically enable SERAC_ENABLE_BENCHMARKS.

let me know your thoughts @white238 @samuelpmish

@chapman39
Copy link
Collaborator

from a discussion with @tupek2 : it would be nice to somehow set -DSMITH_ENABLE_BENCHMARKS=ON and only set that project's benchmarks... im not sure if that would work though, since we need to also set -DENABLE_BENCHMARKS=ON for BLT to setup benchmarking properly.

another thing to consider is these options need to be set properly before BLT is called, which would mean moving this call https://github.com/LLNL/serac/blob/develop/CMakeLists.txt#L127 which may complicate things in the case BLT changes/ adds options, we need to match BLT.

include(${BLT_SOURCE_DIR}/SetupBLT.cmake)

#------------------------------------------------------------------------------
# Setup Macros/Basics
#------------------------------------------------------------------------------

include(${PROJECT_SOURCE_DIR}/cmake/SeracMacros.cmake)
include(${PROJECT_SOURCE_DIR}/cmake/SeracBasics.cmake) # this would need to be called before setupBLT
include(${PROJECT_SOURCE_DIR}/cmake/SeracCompilerFlags.cmake)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants