[CMake] issue with INSTALL and CMAKE_INSTALL_PREFIX
Xavier Delannoy
xavier.delannoy at netasq.com
Thu Oct 5 05:13:38 EDT 2006
CMake 2.4.3 with FreeBSD6.1
I have forgotten to remove an old reference to INSTALL_TARGET in my CMakeLists.txt.
here is my CMakeLists.txt:
INCLUDE(${LIBNBASE_SOURCE_DIR}/sources.txt)
SET(LIBRARY_OUTPUT_PATH "$ENV{BUILDDESTLIB}")
SET(CMAKE_INSTALL_PREFIX "$ENV{DESTDIRPREFIX}")
MESSAGE(STATUS "CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}")
INCLUDE_DIRECTORIES(${NETASQ_LIB_DIR})
INCLUDE_DIRECTORIES(${NETASQ_LIB_DIR}/libnbase)
INCLUDE_DIRECTORIES(${NETASQ_LIB_DIR}/libnbase/${PLATFORM_SUBDIR_SRC})
IF(WIN32)
ADD_DEFINITIONS(-DDLL_EXPORT)
ENDIF(WIN32)
ADD_LIBRARY(nbase_shared SHARED ${LIBNBASE_SRCS})
SET_TARGET_PROPERTIES(nbase_shared PROPERTIES OUTPUT_NAME nbase)
INSTALL(TARGETS nbase_shared DESTINATION usr/Firewall/lib)
IF(WIN32)
TARGET_LINK_LIBRARIES(nbase_shared wsock32)
ENDIF(WIN32)
here is the cmake_install.cmake generated :
# Install script for directory: /home/xavierd/tempbuild/firmware/lib/libnbase
# Set the install prefix
IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
SET(CMAKE_INSTALL_PREFIX "/usr/local")
ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)
STRING(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
# Set the install configuration name.
IF(NOT CMAKE_INSTALL_CONFIG_NAME)
IF(BUILD_TYPE)
STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
ELSE(BUILD_TYPE)
SET(CMAKE_INSTALL_CONFIG_NAME "")
ENDIF(BUILD_TYPE)
MESSAGE(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
ENDIF(NOT CMAKE_INSTALL_CONFIG_NAME)
# Set the component getting installed.
IF(NOT CMAKE_INSTALL_COMPONENT)
IF(COMPONENT)
MESSAGE(STATUS "Install component: \"${COMPONENT}\"")
SET(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
ELSE(COMPONENT)
SET(CMAKE_INSTALL_COMPONENT)
ENDIF(COMPONENT)
ENDIF(NOT CMAKE_INSTALL_COMPONENT)
# Include the install script for each subdirectory.
INCLUDE("/home/xavierd/tempbuild/firmware/lib/libnbase/static/cmake_install.cmake")
INCLUDE("/home/xavierd/tempbuild/firmware/lib/libnbase/shared/cmake_install.cmake")
INCLUDE("/home/xavierd/tempbuild/firmware/lib/libnbase/Tests/cmake_install.cmake")
INCLUDE("/home/xavierd/tempbuild/firmware/lib/libnbase/libnbase_testconf/cmake_install.cm
ake")
IF(CMAKE_INSTALL_COMPONENT)
SET(CMAKE_INSTALL_MANIFEST "install_manifest_${CMAKE_INSTALL_COMPONENT}.txt")
ELSE(CMAKE_INSTALL_COMPONENT)
SET(CMAKE_INSTALL_MANIFEST "install_manifest.txt")
ENDIF(CMAKE_INSTALL_COMPONENT)
FILE(WRITE "/home/xavierd/tempbuild/firmware/lib/libnbase/${CMAKE_INSTALL_MANIFEST}" "")
FOREACH(file ${CMAKE_INSTALL_MANIFEST_FILES})
FILE(APPEND "/home/xavierd/tempbuild/firmware/lib/libnbase/${CMAKE_INSTALL_MANIFEST}" "
${file}\n")
ENDFOREACH(file)
... the installation process failed ;(
>make install
(...)
Install the project...
/home/xavierd/tempbuild/firmware/contrib/cmake/work/cmake-2.4.3/bin/cmake -P cmake_install.cmake
-- Install configuration: ""
-- Install configuration: ""
-- Install configuration: ""
CMake Error: Error in cmake code at
/home/xavierd/tempbuild/firmware/lib/libnbase/shared/cmake_install.cmake:30:
FILE cannot create directory: /usr/local/usr/Firewall/lib. Maybe need administrative privileges.
Current CMake stack: /home/xavierd/tempbuild/firmware/lib/libnbase/cmake_install.cmake;/home/xavierd/tempbuild/firmware/lib/libnbase/shared/cmake_install.cmake
*** Error code 255
Stop in /home/xavierd/tempbuild/firmware/lib/libnbase.
On Thu, 5 Oct 2006 10:35:43 +0200
Xavier Delannoy <xavier.delannoy at netasq.com> wrote:
> hi,
>
> I use CMake 2.4.1 under FreeBSD6.1.
>
> in my CMakeLists.txt (for a shared library) I have :
>
> SET(CMAKE_INSTALL_PREFIX "$ENV{DESTDIRPREFIX}")
> MESSAGE(STATUS "CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX}")
> INSTALL(TARGETS nbase_shared DESTINATION /usr/Firewall/lib)
>
> ...
>
>
> during CMake execution :
> build Makefile for lib/libnbase
> -- Check for working C compiler: gcc
> -- Check for working C compiler: gcc -- works
> -- Check size of void*
> -- Check size of void* - done
> -- libnbase
> -- CMAKE_INSTALL_PREFIX /home/xavierd/tempbuild/firmware/tmp/bin.FW-M-INTERNE
> -- Configuring done
>
> CMAKE_INSTALL_PREFIX is OK, but during the installation process I have :
> Install the project...
> /home/xavierd/tempbuild/firmware/contrib/cmake/work/cmake-2.4.1/bin/cmake -P cmake_install.cmake
> -- Install configuration: "Release"
> CMake Error: Error in cmake code at
> /home/xavierd/tempbuild/firmware/lib/libnbase/shared/cmake_install.cmake:30:
> FILE cannot create directory: /usr/Firewall/lib. Maybe need administrative privileges.
> *** Error code 255
>
> here is my cmake_install.cmake
> # Install script for directory: /home/xavierd/tempbuild/firmware/lib/libnbase/sh
> ared
>
> # Set the install prefix
> IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
> SET(CMAKE_INSTALL_PREFIX "/home/xavierd/tempbuild/firmware/tmp/bin.FW-M-INTERN
> E")
> ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)
> STRING(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
>
> # Set the install configuration name.
> IF(NOT CMAKE_INSTALL_CONFIG_NAME)
> IF(BUILD_TYPE)
> STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
> CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
> ELSE(BUILD_TYPE)
> SET(CMAKE_INSTALL_CONFIG_NAME Release)
> ENDIF(BUILD_TYPE)
> MESSAGE(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
> ENDIF(NOT CMAKE_INSTALL_CONFIG_NAME)
>
> # Set the component getting installed.
> IF(NOT CMAKE_INSTALL_COMPONENT)
> IF(COMPONENT)
> MESSAGE(STATUS "Install component: \"${COMPONENT}\"")
> SET(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
> ELSE(COMPONENT)
> SET(CMAKE_INSTALL_COMPONENT)
> ENDIF(COMPONENT)
> ENDIF(NOT CMAKE_INSTALL_COMPONENT)
>
> FILE(INSTALL DESTINATION "/usr/Firewall/lib" TYPE SHARED_LIBRARY FILES "/home/xavierd/tempbuild/firmware/tmp/libnbase.so")
> FILE(INSTALL DESTINATION "${CMAKE_INSTALL_PREFIX}/usr/Firewall/lib" TYPE SHARED_
> LIBRARY FILES "/home/xavierd/tempbuild/firmware/tmp/libnbase.so")
>
> Why I have 2 FILE(INSTALL ....) ? is this a bug ?
>
> thanks for your help
>
> --
> Xavier Delannoy
>
> R&D engineer
> xavier.delannoy at netasq.com
> http://www.netasq.com
> Tél : +33 320 619 742
> Fax : +33 320 619 639
>
> -----------------------------------------------------------------------
> This communication may contain information that is proprietary,
> privileged or confidential or otherwise legally exempt from disclosure.
> The information contained in this e-mail is intended solely for the
> addressee. Access to this e-mail by anyone else or any unauthorized
> review, use, disclosure or distribution is unauthorized and prohibited.
> If you are not the named addressee indicated in this message (or
> responsible for delivery of the message to such person), you are not
> authorized to read, print, retain, copy or disseminate this message
> or any part of it. If you have received this message in error, please
> notify the sender immediately by fax or e-mail and delete and destroy
> all copies of the message. If you are the intended recipient but do not
> wish to receive communications through this medium, please advise the
> sender immediately. The views expressed in this e-mail are not
> necessarily the views of NetASQ. The company, its directors, officers
> or employees make no representation or accept any liability for its
> accuracy or completeness unless expressly stated to the contrary.
> ------------------------------------------------------------------------
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
--
Xavier Delannoy
R&D engineer
xavier.delannoy at netasq.com
http://www.netasq.com
Tél : +33 320 619 742
Fax : +33 320 619 639
-----------------------------------------------------------------------
This communication may contain information that is proprietary,
privileged or confidential or otherwise legally exempt from disclosure.
The information contained in this e-mail is intended solely for the
addressee. Access to this e-mail by anyone else or any unauthorized
review, use, disclosure or distribution is unauthorized and prohibited.
If you are not the named addressee indicated in this message (or
responsible for delivery of the message to such person), you are not
authorized to read, print, retain, copy or disseminate this message
or any part of it. If you have received this message in error, please
notify the sender immediately by fax or e-mail and delete and destroy
all copies of the message. If you are the intended recipient but do not
wish to receive communications through this medium, please advise the
sender immediately. The views expressed in this e-mail are not
necessarily the views of NetASQ. The company, its directors, officers
or employees make no representation or accept any liability for its
accuracy or completeness unless expressly stated to the contrary.
------------------------------------------------------------------------
More information about the CMake
mailing list