-
-
Notifications
You must be signed in to change notification settings - Fork 52
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
Library options are not exported to calling projects #275
Comments
If you want to change the default config values of a sub project set the options before call include(FetchContent)
FetchContent_Declare(
glfw
GIT_REPOSITORY https://github.com/glfw/glfw.git
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/glfw-src"
GIT_TAG "master"
GIT_SHALLOW TRUE
)
set(GLFW_BUILD_WAYLAND ON)
set(GLFW_BUILD_X11 OFF)
FetchContent_MakeAvailable(glfw) or option(USE_BOOST "build with BOOST support" ON)
if(USE_BOOST)
option(Boost_DEBUG "find boost at verbose mode" OFF)
option(Boost_USE_STATIC_LIBS "use static libs only" OFF)
option(Boost_USE_MULTITHREADED "use -mt libs only" ON)
find_package(Boost 1.71 CONFIG REQUIRED COMPONENTS atomic chrono filesystem thread unit_test_framework)
if(Boost_FOUND)
add_definitions(-DBOOST_ALL_NO_LIB)
include_directories(include)
endif()
endif() |
Thank you for your quick answer. I'll try to clarify my question. |
What do you mean with They are not at https://github.com/aminya/project_options?tab=readme-ov-file#readme |
Sorry, I meant |
I have updated the text of the issue to include a more detailed |
Your logic is wrong!An You need something like this https://github.com/ClausKlein/boost-modules-bench/blob/develop/asio-module/AsioConfig.cmake.in And this is not supported by |
I agree that the config can be done by the user, but the work that must be done if an option is activated may be complicated, and it would simplify the user's job if that work was done for him upon a simple option's activation. |
I have a header-only library project, and I am using
project_options
to package it, so that it can be used as a dependency for other projects.The library has numerous options, defined with the cmake functions
option
orset
. What I want is to export those options, so that calling projects can configure them.Here is the skeleton of its
CMakeLists.txt
, with the optionsWITH_OPENMP
andCHECK_NAN
:Now, another project has
my_lib
as a dependency. Here is itsCMakeLists.txt
:The compilation of
caller_project
works fine with thisCMakeLists.txt
. My problem is that I can't setmy_lib
's options.I think the options are simply not exported, since I don't see them when I use the
ccmake
command. (On the other hand, ifmy_lib
's dependencies have options themselves, I can see them inccmake
.)I tried using
dynamic_project_options
with and withoutENABLE_CACHE
, but no luck...Thank you for your support.
Upvote & Fund
@aminya is using Polar.sh so you can upvote and help fund this issue. The funding is received once the issue is completed & confirmed by you.
Thank you in advance for helping prioritize & fund our backlog!
The text was updated successfully, but these errors were encountered: