Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ArmarXCore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Container Registry
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software
ArmarX
ArmarXCore
Merge requests
!221
CMake package finder: use environment variables instead of global cmake registry
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
CMake package finder: use environment variables instead of global cmake registry
cmake-package-finder-use-environment-variables
into
master
Overview
5
Commits
2
Pipelines
0
Changes
2
All threads resolved!
Hide all comments
Merged
Fabian Reister
requested to merge
cmake-package-finder-use-environment-variables
into
master
2 years ago
Overview
5
Commits
2
Pipelines
0
Changes
2
All threads resolved!
Hide all comments
Expand
Benefits:
workspace-scoped discovery of CMake / ArmarX packages
global cmake registry might not be available if disabled by the user => incorrect list of packages
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
6c67f887
2 commits,
2 years ago
2 files
+
35
−
13
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
source/ArmarXCore/core/system/cmake/CMakePackageFinder.cpp
+
34
−
12
Options
@@ -50,10 +50,14 @@
#include
<memory>
#include
<ctime>
#include
<mutex>
#include
<cstdlib>
#define SCRIPT_PATH "ArmarXCore/core/system/cmake/FindPackageX.cmake"
#define CACHE_PATH "/ArmarXCMakeCache_" + (getenv("USER")?getenv("USER"):"DUMMY_USER")
extern
char
**
environ
;
namespace
armarx
{
std
::
string
getHomeDir
()
@@ -435,23 +439,41 @@ namespace armarx
{
std
::
vector
<
std
::
string
>
result
;
using
namespace
std
::
filesystem
;
auto
home
=
getHomeDir
();
if
(
!
home
.
empty
())
{
path
p
=
path
{
home
}
/
".cmake"
/
"packages"
;
if
(
is_directory
(
p
))
char
**
env
;
env
=
environ
;
for
(;
*
env
;
++
env
)
{
const
std
::
string
envVar
(
*
env
);
ARMARX_DEBUG
<<
"Retrieved environment variable "
<<
envVar
;
const
std
::
vector
<
std
::
string
>
elements
=
simox
::
alg
::
split
(
envVar
,
"="
);
if
(
not
(
elements
.
size
()
==
2
))
{
for
(
const
path
&
entry
:
boost
::
make_iterator_range
(
directory_iterator
(
p
),
{}))
continue
;
}
const
std
::
string
&
envVarName
=
elements
.
front
();
const
std
::
string
&
envVarValue
=
elements
.
back
();
if
(
simox
::
alg
::
ends_with
(
envVarName
,
"_DIR"
))
{
const
std
::
string
packageName
=
simox
::
alg
::
remove_suffix
(
envVarName
,
"_DIR"
);
auto
pckFinder
=
CMakePackageFinder
{
packageName
,
envVarValue
,
true
};
ARMARX_DEBUG
<<
"Package name: "
<<
packageName
;
ARMARX_DEBUG
<<
"Path: "
<<
envVarValue
;
// check if this is really a package
if
(
pckFinder
.
packageFound
()
&&
!
pckFinder
.
getBuildDir
().
empty
())
{
const
std
::
string
pkg
=
entry
.
filename
().
string
();
auto
pckFinder
=
CMakePackageFinder
{
pkg
,
""
,
true
};
if
(
pckFinder
.
packageFound
()
&&
!
pckFinder
.
getBuildDir
().
empty
())
{
result
.
push_back
(
pkg
);
}
ARMARX_VERBOSE
<<
"Found package "
<<
packageName
;
result
.
push_back
(
packageName
);
}
}
}
return
result
;
}
Loading