Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [Solved] [Linux] How do I make cmake configure/install the pkg-config files?  (Read 12029 times)

0 Members and 2 Guests are viewing this topic.

Ancurio

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
I apologize if this has been posted before. Being a cmake noob, I tried everything I could think of:

Code: [Select]
cmake INSTALL_PKGCONFIG_FILES ..
cmake SFML_INSTALL_PKGCONFIG_FILES ..
cmake BUILD_SHARED_LIBS:bool=true INSTALL_PKGCONFIG_FILES:bool=true ..
cmake BUILD_SHARED_LIBS:bool=true SFML_INSTALL_PKGCONFIG_FILES:bool=true ..

Frustrated, I just gave up and moved the pkg-config generating code out of the conditional clauses in CMakeLists.txt (and voila, I got my .pc files), but since I'm helping someone else install these I'd still like to know, how do you properly tell cmake to generate the pkg-config files?

Also, why aren't they generated/installed by default on Linux?? In two years I have never come across a library that doesn't automatically install those.
« Last Edit: October 13, 2013, 02:41:57 pm by Ancurio »

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: how do I make cmake configure/install the pkg-config files?
« Reply #1 on: October 13, 2013, 02:17:47 pm »
I can't help directly but since I'm sure it'll come up: What version of the SFML sources are you using?  From what I saw on Ubuntu the Linux packages for SFML are so out of date it's not even funny.

Ancurio

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: how do I make cmake configure/install the pkg-config files?
« Reply #2 on: October 13, 2013, 02:21:07 pm »
I can't help directly but since I'm sure it'll come up: What version of the SFML sources are you using?  From what I saw on Ubuntu the Linux packages for SFML are so out of date it's not even funny.

git head.

Ancurio

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: [Linux] How do I make cmake configure/install the pkg-config files?
« Reply #3 on: October 13, 2013, 02:40:23 pm »
Sorry for the premature thread, after more googling and experimenting, I finally found out how to do it:

Code: [Select]
cmake -DSFML_INSTALL_PKGCONFIG_FILES=true ..
Sometimes I wish cmake had something as convenient as ./configure --help .....

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Quote
Sometimes I wish cmake had something as convenient as ./configure --help .....
CMake has a complete manual page that explains everything.

Quote
Also, why aren't they generated/installed by default on Linux?? In two years I have never come across a library that doesn't automatically install those.
They are generated with local paths, so they can't be distributed.

I'm not the one who added this feature to SFML, so I don't know if it can be handled in a better way, and have no time to invest in this.
Laurent Gomila - SFML developer

Ancurio

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Quote
Sometimes I wish cmake had something as convenient as ./configure --help .....
CMake has a complete manual page that explains everything.
That's not what I meant. I meant the part of "./configure --help" that will list you all configure time options, such as which parts of the library to enable, if static or shared, etc. All those options that aren't inherent in cmake, but which are defined by projects themselves.

Quote
Also, why aren't they generated/installed by default on Linux?? In two years I have never come across a library that doesn't automatically install those.
They are generated with local paths, so they can't be distributed.

Hm, not really sure what you mean by that.
Edit: What I'm saying is, libraries are installed with local paths just like the .pc files, this is completely normal on Linux.
« Last Edit: October 13, 2013, 04:58:50 pm by Ancurio »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Quote
That's not what I meant. I meant the part of "./configure --help" that will list you all configure time options, such as which parts of the library to enable, if static or shared, etc. All those options that aren't inherent in cmake, but which are defined by projects themselves.
Then you can use cmake -i (or even cmake-gui).

Quote
Hm, not really sure what you mean by that.
I mean that if I distribute the pkconfig files that are generated by the CMake build, they will link to /home/laurent/sfml. Definitely not something you have on your own PC ;)

The pkgconfig files are ok only if you build & install SFML yourself.
Laurent Gomila - SFML developer

Ancurio

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Then you can use cmake -i.
Oh that looks pretty convenient, thanks!

I mean that if I distribute the pkconfig files that are generated by the CMake build, they will link to /home/laurent/sfml. Definitely not something you have on your own PC ;)

The pkgconfig files are ok only if you build & install SFML yourself.
Hm? I think we're having a misunderstanding. I was saying "why are the pkgconfig files not installed by default when building from source". The precompiled packages in Linux distro repositories (at least on Fedora, I'm pretty sure also on Debian based) always provide the pkg-config files already anyway, so it's really only people building from source that don't automatically get them.
« Last Edit: October 13, 2013, 05:20:45 pm by Ancurio »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Quote
I was saying "why are the pkgconfig files not installed by default when building from source"
The default set of options are (and must remain) what's used to create the official SFML packages, ready to be distributed. SFML packages containing local paths in pkgconfig files were distributed by mistake before (SFML 2.0), and it would have happened again if I didn't switch this option off by default.
Laurent Gomila - SFML developer

Ancurio

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Quote
I was saying "why are the pkgconfig files not installed by default when building from source"
The default set of options are (and must remain) what's used to create the official SFML packages, ready to be distributed. SFML packages containing local paths in pkgconfig files were distributed by mistake before (SFML 2.0), and it would have happened again if I didn't switch this option off by default.

I still don't understand... if you set the install path to something user specific under $HOME (I have no idea why anyone would want to do something insane like that), then the libraries in the package would be installed to this local path too. Ie., you can't install the pkg-config files into an non-sane path without screwing up the libraries as well.

I don't know where the official packages put the libraries, but it will probably be something like /usr/lib or /usr/lib64, hence the pkg-config files will always go into /usr/lib/pkgconfig or /usr/lib64/pkgconfig.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
If I remember correctly, the pkgconfig files will contain the path to the CMake build folder, not to the final install folder. As I said I'm not the one who implemented this feature, and I have no time to invest on it. But feel free to send a patch if you feel like it could be improved ;)
Laurent Gomila - SFML developer

Ancurio

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
If I remember correctly, the pkgconfig files will contain the path to the CMake build folder, not to the final install folder. As I said I'm not the one who implemented this feature, and I have no time to invest on it. But feel free to send a patch if you feel like it could be improved ;)

That's not how it works. The pkg-config files point to the libraries and headers where they would end up installed . If i was to send a patch, all it would do is remove the need to specifically enable them. I think I'll track down the guy that implemented them in the first place and ask his opinion on the matter.

Edit: You can look at the .pc.in file yourself, it uses @CMAKE_INSTALL_PREFIX@ so there's no way local build paths would sneak in anywhere.
« Last Edit: October 15, 2013, 02:59:24 am by Ancurio »

Ancurio

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
I contacted him, here's an excerpt:

Quote
I've skimmed the forum thread: my opinion is that if the pkg-config
templates are being filled in with CMake build paths instead of
install paths then that's a bug and should be fixed. However, looking
at the current pkg-config template files on github, the variable they
look for is @CMAKE_INSTALL_PREFIX@, which should be the right thing
(it's basically equivalent to the --prefix variable you would pass to
./configure in an autotools build system). I would install the
pkg-config files by default, too, but for that you'll have to convince
the SFML maintainer(s).

Basically, what I said already.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Ah yes, sorry. It indeed uses the right path, it's me who uses a non-standard path because I have multiple builds of SFML on my Linux installation, and don't want to pollute my system.

But since SFML has no install script, and can be "installed" (= copied) anywhere, it wouldn't be safe anyway even if those files contained standard paths.
Laurent Gomila - SFML developer

Ancurio

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
But since SFML has no install script, and can be "installed" (= copied) anywhere, it wouldn't be safe anyway even if those files contained standard paths.

What install script would you need if you can just
make install
?

But you mentioned that you have a special setup of packaging etc., so if that would get messed up I'll accept your decision to leave things as they are.

 

anything