View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0011446 | CMake | CMake | public | 2010-11-11 11:47 | 2011-01-06 17:00 | ||||
Reporter | lesmana | ||||||||
Assigned To | Bill Hoffman | ||||||||
Priority | normal | Severity | minor | Reproducibility | have not tried | ||||
Status | closed | Resolution | won't fix | ||||||
Platform | OS | OS Version | |||||||
Product Version | |||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0011446: cmake should generate .pc file | ||||||||
Description | or alternatively: cmake should generate makefiles which generates a .pc file i will try to explain the idea using VTK as example. suppose i have downloaded and build VTK in the directory ~/VTK-build. i have my own little project which is using VTK. now the problem is: how do i get the CXXFLAGS and LDFLAGS for my project to compile using VTK in ~/VTK-build. if i use cmake for my project i can use: FIND_PACKAGE(VTK REQUIRED) INCLUDE(${VTK_USE_FILE}) if i can't or won't use cmake, i could use the pkg-config command to fetch the CXXFLAGS and LDFLAGS from the prepared .pc file. read here for more: http://en.wikipedia.org/wiki/Pkg-config [^] http://www.flameeyes.eu/autotools-mythbuster/pkgconfig/index.html [^] | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | ![]() | ||||||||
Relationships | |
Relationships |
Notes | |
(0023186) Alex Neundorf (developer) 2010-11-11 15:43 |
I don't think that's a good idea. pkg-config has problems, cmake can do better. pkg-config simply prints to stdout a set of command line options hardcoded in a text file which are hopefully correct for the compiler you are using. An alternative could be to add something to cmake so it can be used similar to pkgconfig, something like $ cmake --find-package=JPEG --print-include-dirs --compilerID=GNU or so, which would basically run the find_package(JPEG) command and print the results to stdout for GNU compilers. This can then be used the same way as pkg-config in non-cmake Makefiles. Alex |
(0023250) lesmana (reporter) 2010-11-15 04:39 |
it is true that pkg-config just prints out some "hardcoded" strings from a text file, but that text file is (or would be) generated by CMake along with the Makefile. as far as i understand the compiler options and stuff are fixed once VTK has been installed on a system. but i see your points. a cmake option --find-package will work just as well. |
(0023497) Alex Neundorf (developer) 2010-11-22 15:47 |
I attached a cmake-config.cmake script as a very quick first try. You can execute it with cmake in script-mode to search packages and print to stdout which flags are needed for compiling and which flags are needed for linking. Example: $ cmake -DMODE=COMPILE -DCOMPILER_ID=GNU -DPACKAGE=PNG -P cmake-config.cmake -I/usr/include -I/usr/include $ cmake -DMODE=LINK -DCOMPILER_ID=GNU -DPACKAGE=PNG -P cmake-config.cmake /usr/lib/libpng.so /usr/lib/libz.so So 3 variables/arguments are supported: * MODE: this is either "COMPILE" (gives the include dirs and definitions) or "LINK" (gives the libraries) or "EXIST" (fails if the package has not been found) * PACKAGE: the name of the package, i.e. the same as used for the find_package() call * COMPILER_ID: the CMAKE_C_COMPILER_ID, i.e. "GNU" for gcc, "Intel" for icpc, etc. I didn't actually try yet to use this in a Makefile, maybe the line breaks in the output make problems. Also, it does not yet work with all Find-modules (i.e. not with those which are using e.g. try_compile()). So it needs a bit more work than half an hour to get fully working. Alex |
(0023498) Alex Neundorf (developer) 2010-11-22 16:16 |
Brad wrote: Consider implementing the outer-most script in bash (or plain bourne shell). Internally it can run "cmake" on a test project that prints information during its configuration but never builds. Then you can use sed to parse out the results. |
(0024495) Bill Hoffman (manager) 2011-01-06 17:00 |
Unless there is a patch and buy in on the cmake-developers list for this issue, I can not see it happening, so I am closing the issue. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2010-11-11 11:47 | lesmana | New Issue | |
2010-11-11 15:43 | Alex Neundorf | Note Added: 0023186 | |
2010-11-15 04:39 | lesmana | Note Added: 0023250 | |
2010-11-22 15:38 | Alex Neundorf | File Added: cmake-config.cmake | |
2010-11-22 15:47 | Alex Neundorf | Note Added: 0023497 | |
2010-11-22 16:16 | Alex Neundorf | Note Added: 0023498 | |
2011-01-06 17:00 | Bill Hoffman | Note Added: 0024495 | |
2011-01-06 17:00 | Bill Hoffman | Status | new => closed |
2011-01-06 17:00 | Bill Hoffman | Assigned To | => Bill Hoffman |
2011-01-06 17:00 | Bill Hoffman | Resolution | open => won't fix |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |