Skip to content

Commit

Permalink
CMake: CMAKE_INSTALL_PREFIX for Linux (#243)
Browse files Browse the repository at this point in the history
* CMake: CMAKE_INSTALL_PREFIX for Linux

If on Linux system CMAKE_INSTALL_PREFIX is set it overrides
CPACK_PACKAGING_INSTALL_PREFIX key.

* Readme: readme for MinGW building and installation

* Update README.markdown
  • Loading branch information
pshurgal authored and Kjell Hedström committed Jan 9, 2018
1 parent 11f9f06 commit 217f52f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 7 deletions.
12 changes: 5 additions & 7 deletions CPackLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@
# DESTINATION include
# COMPONENT headers)

IF(MINGW)
SET(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/g3log")
ENDIF()

IF(NOT MINGW)
IF(NOT CPACK_PACKAGING_INSTALL_PREFIX)
IF(NOT CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
ELSEIF(NOT CPACK_PACKAGING_INSTALL_PREFIX)
SET(CPACK_PACKAGING_INSTALL_PREFIX /usr/local)
ENDIF()
ENDIF()
Expand Down Expand Up @@ -82,8 +80,8 @@ message( STATUS "make package" )
message( STATUS "\nOption to install using 'make install'" )
message( STATUS "Installation locations: " )
message( STATUS "====================" )
message( STATUS "Headers: ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_HEADERDIR}" )
message( STATUS "Library installation directory: ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" )
message( STATUS "Headers: ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_HEADERDIR}" )
message( STATUS "Library installation directory: ${CPACK_PACKAGING_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" )

message( STATUS "For more information please see g3log/CPackLists.txt\n\n" )
IF(NOT MINGW)
Expand Down
23 changes: 23 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,14 @@ cd ../../
mkdir build
cd build
```
## Configuring for installing on nix (OSX, Linux, MinGW)
Default install prefix on Linux is `/usr/local`
To change it please set `CPACK_PACKAGING_INSTALL_PREFIX `
```
cmake -DCPACK_PACKAGING_INSTALL_PREFIX= ...
```
## Building on Linux
```
Expand All @@ -227,6 +235,21 @@ make package
sudo dpkg -i g3log-<version>-Linux.deb
```
## Building on MinGW
```
cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release ..
make
```
## Installing on MinGW
```
make install
```
Alternative using NSIS
```
make package
g3log-<version>-win32.exe
```
## Building on Windows
Please use the Visual Studio 12 (2013) command prompt "Developer command prompt"
```
Expand Down

0 comments on commit 217f52f

Please sign in to comment.