From: Alan W. I. <Ala...@gm...> - 2019-12-24 19:15:12
|
On 2019-12-24 13:51+0100 Xavier Cardil wrote: > I am now porting a program from Python to C++ that uses Plplot > > Getting this error when running Cmake in my project : > > [cmake] CMake Error at lib/plplot.git/CMakeLists.txt:60 > (cmake_minimum_required): > [cmake] CMake 3.13.2 or higher is required. You are running version > 3.10.2 > > But my system Cmake version is cmake version 3.16.2 > > This is my Makelists.txt: > > cmake_minimum_required(VERSION 3.0.0) > project(autoplot++ VERSION 0.1.0) > > include(CTest) > enable_testing() > > add_executable(autoplot++ main.cpp) > > add_subdirectory(lib/yaml-cpp) > > add_subdirectory(lib/plplot.git) > > include_directories( > lib/yaml-cpp/include, > lib/plplot.git/bindings/c++ > ) > > target_link_libraries( > autoplot++ > PRIVATE > yaml-cpp > ) > > target_link_libraries( > autoplot++ > PRIVATE > plplot > ) > > set(CPACK_PROJECT_NAME ${PROJECT_NAME}) > set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) > include(CPack) > Hi Xavier: If PLplot is complaining that you are using CMake-3.10.2, then that is very likely the case. So if running Linux or some other Unix, try which cmake from the commmand line to see where you are picking up that old version. Also, to diagnose the problem more directly (and my experience is that using old versions of cmake is a bad idea so that is really a problem) I would change to cmake_minimum_required(VERSION 3.13.2) in your own project. Beyond that, I have never tried building plplot as a sub-project of another project like you are attempting to do. I am pretty sure that method "should" work, but I am also sure there are some PLplot details that would have to be adjusted upstream by us to make sure it really does work. (For example, there is a distinction between CMAKE_SOURCE_DIR and PROJECT_SOURCE_DIR, and similarly for the *BINARY* equivalents of those variables which we have not been careful about.) So for now I would advise avoiding that method, and instead I suggest you configure, build, and install PLplot independently. For such an independent PLplot install, an example of how you access that install from a different CMake project is given in examples/CMakeLists.txt for the case where CORE_BUILD is not true (i.e., this is an example project where the installed source code for the examples is being built against the installed PLplot libraries). In other words, your own CMake project should follow what is done in that file starting at "# MAINTENANCE 2019-02-03" Good luck, let us know how it goes, and best wishes for the season. Alan __________________________ Alan W. Irwin Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); the Time Ephemerides project (timeephem.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ |