[CMake] Set a variable?

motes motes mort.motes at gmail.com
Tue Sep 22 10:36:51 EDT 2009


On Tue, Sep 22, 2009 at 3:55 PM, James C. Sutherland
<James.Sutherland at utah.edu> wrote:
>
> On Sep 22, 2009, at 6:16 AM, motes motes wrote:
>
>> In a CMakeList.txt file I have:
>>
>> SET(ELASTIX_BUILD E:/local/lib/elastix_sources_v4.1/src/build)
>> ...
>>
>> LINK_DIRECTORIES(${ELASTIX_BUILD}/Components/Optimizers/StandardGradientDescent)
>>
>>
>>
>>
>> I would to be able to specify the variable: ELASTIX_BUILD when I read
>> the CMakeList.txt file and then choose it from the file browser. I
>> have tried:
>>
>> FIND_PACKAGE(ELASTIX_BUILD REQUIRED)
>>
>> Its now possible to select the path when I run CMake, but I get an
>> error when I press configure:
>>
>> ....which is not a directory containing a package configuraion file....
>>
>> Any ideas on how to specify that a variable should be set when running
>> CMake?
>>
>
> Perhaps this is what you want?
>
> SET(
>   ELASTIX_BUILD
>   E:/local/lib/elastix_sources_v4.1/src/build
>   CACHE PATH
>   )


No the point was not to hardcode the path in the CMakefile.txt. I now use:

FIND_PATH(ELASTIX_BUILD REQUIRED)

And that works, when I start CMake I then select the path to the build
directory.






_________________________
> 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
>


More information about the CMake mailing list