Giter Club home page Giter Club logo

Comments (13)

ClausKlein avatar ClausKlein commented on May 22, 2024 1

Fine, I like this: https://github.com/approvals/ApprovalTests.cpp/blob/master/CMake/WarningsAsErrors.cmake

from ut.

ClausKlein avatar ClausKlein commented on May 22, 2024

That is caused by my changes, I have noted to it during review!

the project name was changed to ut.
the imported target to Boost::ut

see

# Create target Boost::ut and install target

from ut.

claremacrae avatar claremacrae commented on May 22, 2024

That is caused by my changes, I have noted to it during review!

the project name was changed to ut.
the imported target to Boost::ut

see

# Create target Boost::ut and install target

Thanks for the reply.

There's nearly 500 stars and more than 40 forks of this project, so that's a lot of people, many of whom have to update their builds.

And those of us that maintain libraries that provide interfaces to this project now have to decide whether to drop supporting the older versions, or not support newer versions....

Please consider maintaining aliases for backwards compatibility, to prevent this breaking change.

from ut.

ClausKlein avatar ClausKlein commented on May 22, 2024

And those of us that maintain libraries that provide interfaces to this project now have to decide whether to drop supporting the older versions, or not support newer versions....

Please consider maintaining aliases for backwards compatibility, to prevent this breaking change.

one problem was: the config version.cmake file were not installed.
so the find-package(...) does not realy work!

and other Boost components are all exported as i.e. Boost::filesystem

Is it possible to do add_library(boost.ut ALIAS Boost::ut) after FetchContent_MakeAvailable()?

from ut.

claremacrae avatar claremacrae commented on May 22, 2024

and other Boost components are all exported as i.e. Boost::filesystem

That's a really interesting point...

I really agree with the name chosen for this project in Conan-center-index, which is boost-ext-ut - the reason I agree is that this project isn't part of boost, and calling its target Boost.ut creates a cause for confusion, I feel... The name boost-ext-ut feels fairer - suggesting external.

https://github.com/conan-io/conan-center-index/tree/master/recipes/boost-ext-ut

Is it possible to do add_library(boost.ut ALIAS Boost::ut) after FetchContent_MakeAvailable()?

I think it's not that simple... it would have to be something like this pseudo-code:

if target Boost::ut exists 
    add_library(boost.ut ALIAS Boost::ut)
endif

Why impose that on users, and more importantly, the time taken to research the problem when they get the failure, as happened to me today - when it could be a one-liner inside the project?

from ut.

ClausKlein avatar ClausKlein commented on May 22, 2024

you should be happy, it works now without your config hacks:

bash-3.2$ git diff
diff --git a/dev_approvals_fetch_content/CMakeLists.txt b/dev_approvals_fetch_content/CMakeLists.txt
index 8e2eaa9..bf562b8 100644
--- a/dev_approvals_fetch_content/CMakeLists.txt
+++ b/dev_approvals_fetch_content/CMakeLists.txt
@@ -132,14 +132,16 @@ FetchContent_Declare(boost.ut
         GIT_TAG ${UtVersion})
 FetchContent_MakeAvailable(boost.ut)
 
-if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
-    # Turn off some checks off for boost.ut
-    target_compile_options(boost.ut INTERFACE
-            -Wno-c99-extensions # Needed for Boost.ut, at least in v1.1.6
-            -Wno-documentation-unknown-command # unknown command tag name \userguide
-            -Wno-weak-vtables
-            -Wno-comma # See https://github.com/boost-ext/ut/issues/398
-            )
+if(TARGET boost.ut)
+    if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
+        # Turn off some checks off for boost.ut
+        target_compile_options(boost.ut INTERFACE
+                -Wno-c99-extensions # Needed for Boost.ut, at least in v1.1.6
+                -Wno-documentation-unknown-command # unknown command tag name \userguide
+                -Wno-weak-vtables
+                -Wno-comma # See https://github.com/boost-ext/ut/issues/398
+                )
+    endif()
 endif()
 
 # -------------------------------------------------------------------
bash-3.2$ 

from ut.

ClausKlein avatar ClausKlein commented on May 22, 2024

@claremacrae one note: IMHO the fetchcontents is very slow and not very flexible to use.

would it be an option to try https://github.com/cpm-cmake/CPM.cmake

with local cache enable, it is really fast!

from ut.

claremacrae avatar claremacrae commented on May 22, 2024

you should be happy, it works now without your config hacks:

....

Thanks - I appreciate the suggestion....

One of the benefits of the ApprovalTests.cpp.CMakeSamples project is for me to test out code against multiple different versions of Boost.ut, when we get bug reports from ApprovalTests users, such as approvals/ApprovalTests.cpp#157

Hence my desire to be able to keep building against a variety of Boost.ut versions...

from ut.

claremacrae avatar claremacrae commented on May 22, 2024

@claremacrae one note: IMHO the fetchcontents is very slow and not very flexible to use.

would it be an option to try https://github.com/cpm-cmake/CPM.cmake

with local cache enable, it is really fast!

Thanks for that suggestion too...

Another of the benefits - in fact purposes - of ApprovalTests.cpp.CMakeSamples is to provide tested CMake code that we can embed in to the ApprovalTests.cpp docs, at these two pages:

What I'm after is simple, standard things that work with CMake out of the box - and Conan out of the box - so that I can give new users at least one simple thing to try for them...

So there's no advantage to me in having a layer on top to speed things up, as it one more thing to document and test....

For that kind of documentation - and the target audience of people getting started - simpler is better...

Anyone who already knows about CPM or similar is of course free to disregard the pointers we give, and make their own way...

from ut.

claremacrae avatar claremacrae commented on May 22, 2024

Is it possible to do add_library(boost.ut ALIAS Boost::ut) after FetchContent_MakeAvailable()?

Just to help anyone else who comes here, the above gives an error about Boost::ut already being an alias.

This works:

add_library(boost.ut ALIAS ut)

from ut.

krzysztof-jusiak avatar krzysztof-jusiak commented on May 22, 2024

@claremacrae would the following be okay?

from ut.

claremacrae avatar claremacrae commented on May 22, 2024

@claremacrae would the following be okay?

Thanks! I've answered in that ticket...

I worked around the issue before you kindly added that, but I think it's likely that the change will affect others as well.

Also for others here, the suggestion in #430 (comment) didn't work for me with clang9, with the latest boost.ut. I still got lots of warnings about C99 code...

This is what I needed, to work with Clang 9 on Linux:

message(NOTICE "Fetching boost.ut...")
set(BUILD_BENCHMARKS OFF CACHE BOOL "")
set(BUILD_EXAMPLES OFF CACHE BOOL "")
set(BUILD_TESTS OFF CACHE BOOL "")
FetchContent_Declare(boost.ut
        GIT_REPOSITORY https://github.com/boost-ext/ut.git
        GIT_TAG ${UtVersion})
FetchContent_MakeAvailable(boost.ut)

if(TARGET Boost::ut)
    add_library(boost.ut ALIAS ut)
endif()

if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
    # Turn off some checks off for boost.ut
    target_compile_options(ut INTERFACE
            -Wno-c99-extensions # Needed for Boost.ut, at least in v1.1.6
            -Wno-documentation-unknown-command # unknown command tag name \userguide
            -Wno-weak-vtables
            -Wno-comma # See https://github.com/boost-ext/ut/issues/398
            )
endif()

from ut.

claremacrae avatar claremacrae commented on May 22, 2024

Closing, since based on the comments, it seems unlikely that it's worth leaving open...

I've added notes above, in the hope of helping others out....

from ut.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.