akheron / jansson

C library for encoding, decoding and manipulating JSON data
http://www.digip.org/jansson/
Other
3.06k stars 815 forks source link

Target settings do not automatically populate when using CMake FetchContent #663

Open Andrew-Au opened 1 year ago

Andrew-Au commented 1 year ago

MacOS using XCode

Create FetchContent import as follows:

include( FetchContent )
FetchContent_Declare(
    jansson
    GIT_REPOSITORY https://github.com/akheron/jansson.git
    GIT_TAG 684e18c927e89615c2d501737e90018f4930d6c5 # v2.14
)

FetchContent_MakeAvailable(
    jansson
)

What works:

What fails:


I enquired on the CMake forums and the FetchContent experts explained that the problem was the Jansson project not using per-target options. Because these are missing, the options are not exported along with the target and the build fails.

Proposed fixes:

Testing on OS X with CMake 3.26

JosiahWI commented 2 months ago

I am interested in working on implementing the proposed solution. Edit: I see this is already being done.