[Insight-developers] SimpleITK - CMake question (The Saga of Eggs on Windows…)
Bradley Lowekamp
blowekamp at mail.nih.gov
Mon Sep 19 21:08:18 EDT 2011
Hello David,
I was thinking about just making a generic re-usable macro to accomplish this. What would make this macro really useful is not having to passing a list of cmake variables, which need to be passed to the launched CMake subprocess.
Would you happen to have some cmake code which would scan a configuration file, and obtain a list of CMake variables which are going to be substituted?
Thanks,
Brad
On Sep 19, 2011, at 1:54 PM, David Cole wrote:
> On Sat, Sep 17, 2011 at 5:26 PM, Bradley Lowekamp
> <blowekamp at mail.nih.gov> wrote:
>> Thanks JC,
>> That is very helpful and explains what is going on. And explains that this
>> is a bit of a tricky problem.
>> It appears that the LOCATION property from:
>>
>>> get_target_property( SIMPLEITK_BINARY_MODULE
>>> ${SWIG_MODULE_SimpleITK_REAL_NAME} LOCATION )
>>> configure_file(
>>> ${SimpleITK_SOURCE_DIR}/Wrapping/PythonPackage/setup.py.in
>>> ${SimpleITK_BINARY_DIR}/Wrapping/PythonPackage/setup.py )
>>
>> already has the CMAKE_CFG_INITDIR value embedded in it. So the value of
>> SIMPLEITK_BINARY_MODULE is
>> "C:Build/SimpleITK/lib/$(Configuration)/_SimpleITK.pyd".
>> This value is then later used at configuration time in a "configure_file".
>> Unfortunately, the documentation linked below, reminds me that the
>> configuration type is not known at configuration time and is only known at
>> compilation. So it's impossible to know the value of "$(Configure)" when
>> the configuration file is generated.
>> I guess I need a build time version of "configure_file" which is aware of
>> what build type is occurring…. Anyone done that before?
>
>
> Sure, you can run a cmake script as an add_custom_command at build
> time, and then inside the script, you can use configure_file. You'll
> have to pass -D variable values down into the command if you need
> variable values defined for the configure_file call. It is definitely
> something I've done before.
>
> Let me know specifics if you'd like a recommendation on converting an
> existing configure_file call into a build-time scripted call to it
> instead...
>
>
> David C.
>
>
>> Thanks,
>> Brad
>>
>> ========================================================
>>
>> Bradley Lowekamp
>>
>> Lockheed Martin Contractor for
>>
>> Office of High Performance Computing and Communications
>>
>> National Library of Medicine
>>
>> blowekamp at mail.nih.gov
>>
>> On Sep 17, 2011, at 5:07 PM, Jean-Christophe Fillion-Robin wrote:
>>
>> Hi Bradley,
>>
>> I am assuming you want the variable to be substituted at build time ...
>>
>> Instead of ${Configure} .. try with ${CMAKE_CFG_INTDIR}
>>
>> See
>> http://www.cmake.org/cmake/help/cmake-2-8-docs.html#variable:CMAKE_CFG_INTDIR
>>
>> Hth
>> Jc
>>
>> On Sat, Sep 17, 2011 at 2:59 PM, Bradley Lowekamp <blowekamp at mail.nih.gov>
>> wrote:
>>>
>>> Hello,
>>>
>>> There is a cmake variable which is having the following value:
>>> "C:Build/SimpleITK/lib/$(Configure)/_SimpleITK.pyd"
>>>
>>> And is needs to be:
>>> "C:Build/SimpleITK/lib/Release/_SimpleITK.pyd"
>>>
>>> I can finally get the python egg for distribution on windows system, But
>>> for some reason the "Configure" is not being substituted as needed.
>>>
>>> Here is some other CMake snippets relevant:
>>>
>>> # from SimpleITK/CMAKE/UseSWIGLocal.cmake
>>> ...
>>> ADD_LIBRARY(${SWIG_MODULE_${name}_REAL_NAME}
>>> MODULE
>>> ${swig_generated_sources}
>>> ${swig_other_sources})
>>> ...
>>>
>>> # from SimpleITK/Wrapping/CMakeLists.txt
>>> ..
>>> get_target_property( SIMPLEITK_BINARY_MODULE
>>> ${SWIG_MODULE_SimpleITK_REAL_NAME} LOCATION )
>>> configure_file(
>>> ${SimpleITK_SOURCE_DIR}/Wrapping/PythonPackage/setup.py.in
>>> ${SimpleITK_BINARY_DIR}/Wrapping/PythonPackage/setup.py )
>>> …
>>>
>>>
>>> Any help would be appreciated.
>>>
>>> Thanks,
>>> Brad
>>>
>>> _______________________________________________
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Kitware offers ITK Training Courses, for more information visit:
>>> http://kitware.com/products/protraining.html
>>>
>>> Please keep messages on-topic and check the ITK FAQ at:
>>> http://www.itk.org/Wiki/ITK_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.itk.org/mailman/listinfo/insight-developers
>>
>>
>>
>> --
>> +1 919 869 8849
>>
>>
>>
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Kitware offers ITK Training Courses, for more information visit:
>> http://kitware.com/products/protraining.html
>>
>> Please keep messages on-topic and check the ITK FAQ at:
>> http://www.itk.org/Wiki/ITK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.itk.org/mailman/listinfo/insight-developers
>>
>>
More information about the Insight-developers
mailing list