Fix config.h default data install path assignment during configuration.

* Remove redundant definition of KICAD_DATA_PATH since DEFAULT_INSTALL_PATH
  was already defined.
* Use DEFAULT_INSTALL_PATH as the substitution for the default environment
  variable paths.
* Add option to define DEFAULT_INSTALL_PATH during CMake configuration with
  fall back to CMAKE_INSTALL_PREFIX if not not defined.
* Developer note: this change is primarily for package builders where
  CMAKE_INSTALL_PATH is the path where the package builder temporarily
  installs the build output before creating the package.  When building
  packages, DEFAULT_INSTALL_PATH should be set to the path where the
  package will be installed by default.
This commit is contained in:
Wayne Stambaugh 2015-04-08 13:27:04 -04:00
parent 0d77a8600d
commit 4274f2d5d5
3 changed files with 14 additions and 13 deletions

View File

@ -94,7 +94,7 @@ set( KICAD_REPO_NAME "product" CACHE STRING "Name of the tree from which this bu
set( DOWNLOAD_DIR ${PROJECT_SOURCE_DIR}/.downloads-by-cmake
CACHE PATH "Location of KiCad downloads, suggested is a dir common to all builds, i.e. global." )
#Add option to add user directories for linker, if any
# Add option to add user directories for linker, if any
LINK_DIRECTORIES( ${LINK_DIRECTORIES_PATH} )
if( UNIX )
@ -104,6 +104,16 @@ elseif( MINGW )
endif()
mark_as_advanced( KICAD_USER_CONFIG_DIR )
# Set default data file path to CMAKE_INSTALL_PREFIX if it wasn't specified during the
# CMake configuration. The value of DEFAULT_INSTALL_PATH is expanded in config.h and
# used in the source code to define the base path for kicad search paths and environment
# variables.
if( NOT DEFAULT_INSTALL_PATH )
set( DEFAULT_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}"
CACHE
PATH
"Location of KiCad data files." )
endif()
#================================================
# Set flags for GCC, or treat llvm as GCC

View File

@ -58,17 +58,8 @@
/// The legacy file format revision of the *.brd file created by this build
#define LEGACY_BOARD_FILE_VERSION 2
/// The install prefix defined in CMAKE_INSTALL_PREFIX.
#define DEFAULT_INSTALL_PATH "@CMAKE_INSTALL_PREFIX@"
/// The install prefix used for KiCad's libraries.
/// These paths are only intended to be reasonable default values that work if
/// the user installs KiCad in the default path for a given platform.
#if defined( __APPLE__ )
#define KICAD_DATA_PATH "/Library/Application Support/kicad"
#else
#define KICAD_DATA_PATH "@CMAKE_INSTALL_PREFIX@/@KICAD_DATA@"
#endif
/// The install prefix defined during CMake configuration or fall back to CMAKE_INSTALL_PREFIX.
#define DEFAULT_INSTALL_PATH "@DEFAULT_INSTALL_PATH@"
/// The wxPython version found during configuration.
#if defined( KICAD_SCRIPTING_WXPYTHON )

View File

@ -423,7 +423,7 @@ bool PGM_BASE::initPgm()
m_local_env_vars[ envVarName ] = envVarItem;
wxFileName tmpFileName;
tmpFileName.AssignDir( wxString( wxT( KICAD_DATA_PATH ) ) );
tmpFileName.AssignDir( wxString( wxT( DEFAULT_INSTALL_PATH ) ) );
tmpFileName.AppendDir( wxT( "modules" ) );
envVarName = wxT( "KISYSMOD" );
envVarItem.SetValue( tmpFileName.GetPath() );