mpreal
mpreal copied to clipboard
Add cmake.
This adds cmake support. This is useful to use mpreal as a submodule in another git project that uses cmake. The only targets are the interface (header-only) library mpreal and mpreal_example - the test/example utility. I left the makefile in the example directory as it doesn't impact cmake.
We could set the C++ version back to 11 if you want to. Ed Smith-Rowland
Yes, it is better to remove requirement for C++ standard as mpreal can work with anything down to C++ 2003 and even older.
Please consider removing the restriction on C++ standard. It is really has no sense for MPFR C++. I would prefer keeping GMP/MPFR CMake files out of the MPFR C++ repository. It is responsibility of the main program/target user to find & link to proper GMP/MPFR.
Besides, GMP cannot be used in MSVC (MPIR is used instead). So that including GMP scripts has no sense for a lot of target users.
I'm removing the standard requirement. That's a good idea. I just pushed to my repo.
I took out the GMP and MPFR scripts also. So now it's just a header-only library with no enforced dependencies. W00t!
The CMakeLists does still have mpfr as a target link library for the example but it doesn't seem to need a script if mpfr is on your system.
Ok, now I've pushed the changes to my branch. No sure what happened. I also merged the latest.
Could you please elaborate a bit why do you think CMake is needed for mpreal at all? The mpreal is one-header library, without restrictions on C++ compiler features, on GMP/MPIR/MPFR versions, etc. etc. Basically it is supposed to be used as a simple header file.
I use CMake in most of my projects, but I have difficulties in understanding how it can be useful for mpreal. Would appreciate to see some real example why this can be useful.
This came up when I added mpreal as a submodule in a larger cmake project. This allows another part of the library to have
add_executable(thing ...) target_link_libraries(thing mpreal ...)
So everywhere I use mpreal it's just adding one word in target_link_libraries.
I agree that there's no reason intrinsic to mpreal to have CMakeLists (it does build the example) - it's just easier to integrate into a larger cmake project. Not that it's that hard anyway.
I don't think having CMake would break other ways of using mpreal.