View previous topic :: View next topic |
Author |
Message |
Gentooya n00b
Joined: 15 Nov 2013 Posts: 26
|
Posted: Mon Feb 24, 2014 12:24 pm Post subject: Using cmake-utils in ebuilds |
|
|
Good afternoon
I'm trying to build an ebuild file that initiates my CMAKE based build environment to build my software.
Here is my code for src_configure()
Code: |
einfo "Source configured and placed in ${S}."
CMAKE_USE_DIR=${S}
BUILD_DIR=${CMAKE_USE_DIR}
local mycmakeargs=(
"-DCMAKE_INSTALL_PREFIX=/usr/local"
$(cmake-utils_use debug)
)
# symbol information for debugging
if use debug; then
append-cflags -g
fi
cmake-utils_src_configure
|
Basically my question is about the CFLAGS I want to set with this code. Basically I want to have a -DDEBUG=ON when the debug use flag is set. And I also want to append a "-g" when the debug use flag is set. Both flags are not set with this code though. How would the correct code look like? Can anyone help with this?
The other question I have is that in my CMakeLists.txt I have options, like
Code: |
option(TESTS_ENABLED "TESTS_ENABLED" OFF)
|
How can I set/unset these from my ebuilds? I cannot find the right function for this. Any help would be greatly appreciated.
Last edited by Gentooya on Wed Feb 26, 2014 9:43 am; edited 2 times in total |
|
Back to top |
|
|
Gentooya n00b
Joined: 15 Nov 2013 Posts: 26
|
Posted: Wed Feb 26, 2014 9:41 am Post subject: |
|
|
No one can help on this? |
|
Back to top |
|
|
Gentooya n00b
Joined: 15 Nov 2013 Posts: 26
|
Posted: Thu Feb 27, 2014 9:55 am Post subject: |
|
|
By now I have found out that the above code works, in particular when also including flag-o-matic.
The only thing that does not work yet is to set CMAKE options from ebuild files. Anyone can help on how to do that?
Many thanks for any pointers. |
|
Back to top |
|
|
Gentooya n00b
Joined: 15 Nov 2013 Posts: 26
|
Posted: Mon Mar 24, 2014 3:33 pm Post subject: |
|
|
I still haven't solved the problem of setting CMAKE options from ebuild files. Can anyone help on this? |
|
Back to top |
|
|
bkircher n00b
Joined: 27 Mar 2014 Posts: 2
|
Posted: Thu Mar 27, 2014 9:21 pm Post subject: |
|
|
It seems that the corresponding eclass does not support CMake variables (i.e., like -DCMAKE_BUILD_TYPE=Fubar) to be set from within an ebuild.
We ran into a similar issue at work this week and we might (actually it is in this sprint) fix that and try to push this upstream, i.e., back to Gentoo.
However, don't hold your breath until then. |
|
Back to top |
|
|
bkircher n00b
Joined: 27 Mar 2014 Posts: 2
|
Posted: Mon Mar 31, 2014 4:06 pm Post subject: |
|
|
No need to add functionality. It is already there.
As the name suggests, use mycmakeargs eclass variable in src_configure phase.
For instance, take a look at /usr/portage/dev-libs/soprano/*.ebuild:
<snip>
src_configure() {
# ...
local mycmakeargs=(
-DSOPRANO_BUILD_TESTS=OFF
-DCMAKE_SKIP_RPATH=OFF
-DSOPRANO_DISABLE_SESAME2_BACKEND=ON
-DSOPRANO_DISABLE_CLUCENE_INDEX=ON
$(cmake-utils_use !dbus SOPRANO_DISABLE_DBUS)
$(cmake-utils_use !raptor SOPRANO_DISABLE_RAPTOR_PARSER)
$(cmake-utils_use !redland SOPRANO_DISABLE_RAPTOR_SERIALIZER)
$(cmake-utils_use !redland SOPRANO_DISABLE_REDLAND_BACKEND)
$(cmake-utils_use !virtuoso SOPRANO_DISABLE_VIRTUOSO_BACKEND)
$(cmake-utils_use doc SOPRANO_BUILD_API_DOCS)
$(cmake-utils_use test SOPRANO_BUILD_TESTS)
cmake-utils_src_configure
}
</snip>
This is a good usage example of cmake-utils and flag-o-matic. |
|
Back to top |
|
|
|