Use absolute path CMAKE_INSTALL_FULL_LIBDIR for 3d viewer PLUGINDIR

Currently, the plugindir in the plugin manager is constructed as
{CMAKE_INSTALL_PREFIX}/bin/../{CMAKE_INSTALL_LIBDIR}/kicad/..., while
CMakes install uses {CMAKE_INSTALL_LIBDIR}/kicad/...

In case CMAKE_INSTALL_LIBDIR is a relative path "install" prefixes it
with CMAKE_INSTALL_PREFIX and both paths happen to match, otherwise
the constructed path ends up as e.g. "/usr/bin/../usr/lib/kicad/...".

For these cases where an absolute path is wanted CMake provides the
CMAKE_INSTALL_FULL_<dir> variants which works the same as
CMAKE_INSTALL_<dir> when used as DIRECTORY for install.
This commit is contained in:
Stefan Brüns 2018-10-09 17:35:55 +02:00 committed by Wayne Stambaugh
parent e307d9318b
commit 9490fd9d30
2 changed files with 4 additions and 8 deletions

View File

@ -149,14 +149,10 @@ void S3D_PLUGIN_MANAGER::loadPlugins( void )
#endif
#ifndef _WIN32
// multiarch friendly determination of the plugin directory: the executable dir
// is first determined via wxStandardPaths::Get().GetExecutablePath() and then
// the CMAKE_INSTALL_LIBDIR path is appended relative to the executable dir.
// PLUGINDIR = CMAKE_INSTALL_FULL_LIBDIR path is the absolute path
// corresponding to the install path used for constructing KICAD_USER_PLUGIN
fn.Assign( wxStandardPaths::Get().GetExecutablePath() );
fn.RemoveLastDir();
wxString tfname = fn.GetPathWithSep();
tfname.Append( wxString::FromUTF8Unchecked( PLUGINDIR ) );
wxString tfname = wxString::FromUTF8Unchecked( PLUGINDIR );
fn.Assign( tfname, "");
fn.AppendDir( "kicad" );
#else

View File

@ -1 +1 @@
#define PLUGINDIR "@CMAKE_INSTALL_LIBDIR@"
#define PLUGINDIR "@CMAKE_INSTALL_FULL_LIBDIR@"