Hi Fedja,

As far as I know, the Makefiles generated  from CMake cannot contain decisions. 
CMake supports several output types aside from Makefiles and some of them 
probably don’t support decisions. However, you could supply these arguments 
within CMake call using -D option. For example
    cmake -DENV=VERSION_2 <source_or_binary_directory>
creates a CMake variable just like
    set(ENV "VERSION_2" CACHE)
in the CMake source file.

As you’ve mentioned already, you can access environment variables using 
$ENV{variable} syntax in CMake.

Hope this helps.

Miroslav

From: CMake [mailto:cmake-boun...@cmake.org] On Behalf Of Fedja Jeleskovic
Sent: Friday, April 01, 2016 8:08 PM
To: cmake@cmake.org
Subject: [CMake] Parsing command line arguments from the make

Since I am converting existing makefile project to use cmake instead I need to 
accept values that come from command line which looks like this:
VARIABLE_NAME="/home/user/project" make ENV=VERSION_2

First one is used like this:
include $(VARIABLE_NAME)/Makefile.include

Second one has this code that triggers different paths later:
ifneq ($(ENV),)
DEPLOYMENT_VERSION=$(ENV)
endif

How do I do this in cmake?

Thanks!
-- 

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to