10000 Use built-in CMake module FindX11 by arthurbiancarelli · Pull Request #20 · ThePhD/infoware · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Use built-in CMake module FindX11 #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

arthurbiancarelli
Copy link
Contributor

No description provided.

@nabijaczleweli nabijaczleweli changed the title Use built-in CMake module FindX11 Use built-in CMake module FindX11 and install target Oct 2, 2019
@nabijaczleweli
Copy link
Collaborator

I'm sold on the first commit, but not necessarily on the second one as it is right now – why are we defining the postfixes? what's the purpose of whatever sort of CMake compost's going into $PREFIX/share/infoware/?

@arthurbiancarelli
Copy link
Contributor Author
arthurbiancarelli commented Oct 4, 2019

My mistake on the second commit I did not want to push it on this branch. I pushed here instead, and can make an other pull request if you are interested.

The idea behind the second commit is to create an install target and to export CMake configuration files.

When running make install, you'll have in the installation directory:

├── include
   ├── cpu.hpp
   ├── gpu.hpp
   ├── infoware.hpp
   ├── system.hpp
   └── version.hpp
├── lib
   └── libinfowared.a
└── share
    └── infoware
        ├── infowareConfig-debug.cmake
        ├── infowareConfig.cmake
        └── infowareConfigVersion.cmake

Note: You can configure the installation directory with CMAKE_INSTALL_PREFIX, otherwise it will be the default GNU directories on UNIX platforms (/usr/include, /usr/lib )

To choose the headers that will be exported, you'll have to set them as PUBLIC_HEADERS, hence the variable I added.

The sharefolder is useful for external projects built with CMake too using your library. Indeed in another project, to use this library, all you have to do then is find_package(infoware) and target_link_libraries(${PROJECT_NAME} PRIVATE infoware).
CMake is then handling everything else (Include directories, compile definitions, dependencies).

CMake is creating infowareConfig.cmake that contains the common infos for you project and is creating a config file by build type (infowareConfig-debug.cmake for instance) for specific rules.
The infowareConfigVersion.cmake is just here to handle the versions, for instance an external project can do find_package(infoware 1.0) to have a specific version

When I do find_package(infoware) in my project, CMake will take automatically the corresponding library (debug or release), depending on my project's CMAKE_BUILD_TYPE.

The debug postfix I added (notice the d at the end libinfowared) is not mandatory but useful just to know in which mode the library was built (when configured with CMake with CMAKE_BUILD_TYPE).

@arthurbiancarelli arthurbiancarelli changed the title Use built-in CMake module FindX11 and install target Use built-in CMake module FindX11 Oct 4, 2019
@nabijaczleweli nabijaczleweli merged commit 4cfae74 into ThePhD:master Oct 4, 2019
@nabijaczleweli
Copy link
Collaborator
nabijaczleweli commented Oct 4, 2019

hmm this is making a lot of sense.

Please do open that PR, I have a few nit-picks I'd like to ask you, as someone who understands CMake better, about the commit there?

@nabijaczleweli
Copy link
Collaborator

Released in v0.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0