If I copy/paste your code into a stand-alone CMakeLists.txt file, and
run CMake 2.8.10.1 on my Mac with it, I get the expected output:

"Sample install message." appears during "make install" after you do a
"cmake" and "make" first...

INSTALL_TO_ARTIFACTS is empty during the cmake configure stage... It
is only set when the install script is running at "make install" time.


HTH,
David


DETAILS:
==========================

$ cat CMakeLists.txt
install(CODE "set( INSTALL_TO_ARTIFACTS install )" )
install(CODE "message(\"Sample install message.\")")
message (" INSTALL_TO_ARTIFACTS is: ${INSTALL_TO_ARTIFACTS}" )

$ mkdir build

$ cd build

$ cmake ..
-- The C compiler identification is GNU 4.2.1
-- The CXX compiler identification is GNU 4.2.1
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
 INSTALL_TO_ARTIFACTS is:
CMake Warning (dev) in CMakeLists.txt:
  No cmake_minimum_required command is present.  A line of code such as

    cmake_minimum_required(VERSION 2.8)

  should be added at the top of the file.  The version specified may be lower
  if you wish to support older CMake versions for this project.  For more
  information run "cmake --help-policy CMP0000".
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done
-- Generating done
-- Build files have been written to: /Users/davidcole/K/tmp5/build

$ make

$ make install
Install the project...
-- Install configuration: ""
Sample install message.



On Tue, Nov 13, 2012 at 8:23 PM, Marshall, Rob <r...@qti.qualcomm.com> wrote:
> Hi,
>
> I am trying to use install (CODE) with my cmake script when I invoke "make 
> install" on the command line
> but when I run the "make install" on the following code
>
> install(CODE "set( INSTALL_TO_ARTIFACTS install )" )
> install(CODE "message(\"Sample install message.\")")
> message (" INSTALL_TO_ARTIFACTS is: ${INSTALL_TO_ARTIFACTS}" )
>
>
> INSTALL_TO_ARTIFACTS is not set and "Sample install message." does not display
> I only see "INSTALL_TO_ARTIFACTS is: " in the console window
>
> Is there some additional setting required to make this work?
>
> Thanks,
> Rob
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: 
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to