Hm... this is unfortunate. Would it be possible to keep the 
${EFFECTIVE_PLATFORM_NAME} in place for the install step but return it 
substituted when one asks explicitly using generator expression? From what I 
understood in the docs, the CMAKE_IOS_INSTALL_COMBINED is doing something 
additional during installation step and does not affect generator step -- so I 
think a behavior specific for installation and CMAKE_IOS_INSTALL_COMBINED could 
be separated from direct use of generator expressions. Or am I completely out 
of touch?

Thank you
mosra

______________________________________________________________
> Od: Ruslan Baratov <ruslan_bara...@yahoo.com>
> Komu: "Vladimír Vondruš" <mo...@centrum.cz>
> Datum: 29.03.2016 15:20
> Předmět: Re: [CMake] EFFECTIVE_PLATFORM_NAME not expanded in TARGET_* 
> generator expressions on iOS
>
> CC: cmake@cmake.org
>On 29-Mar-16 16:14, Vladimír Vondruš wrote:
>> I saw that commit, yes. Since there is no additional round of variable 
>> expansion, wouldn't it be better to expand the ${EFFECTIVE_PLATFORM_NAME} to 
>> at least something fixed (based on the value of CMAKE_OSX_SYSROOT), instead 
>> of making the generator expression unusable in all cases? It seems 
>> reasonable to me that if I set CMAKE_OSX_SYSROOT to "iPhoneSimulator", the 
>> output of $<TARGET_LOCATION:something> would be something like
>>
>>      /path/to/my/build/dir/Debug-iphonesimulator/something.framework
>>
>> instead of:
>>
>>      
>> /path/to/my/build/dir/Debug${EFFECTIVE_PLATFORM_NAME}/something.framework
>>
>> Because the latter is unusable, with the former I have at least the ability 
>> to use it with a single fixed SDK.
>>
>> Thanks
>> mosra
>As far as I know you have to set CMAKE_OSX_SYSROOT to "iphoneos" so 
>Xcode project will contain both simulator and device configuration. 
>Without this change such feature like CMAKE_IOS_INSTALL_COMBINED will 
>not work. In other words substituting `${EFFECTIVE_PLATFORM_NAME}` may 
>fit your needs but will broke CMAKE_IOS_INSTALL_COMBINED for everybody 
>(at least if this behaviour will be unconditional).
>
>Ruslo
>
>>
>> ______________________________________________________________
>>> Od: Ruslan Baratov <ruslan_bara...@yahoo.com>
>>> Komu: "Vladimír Vondruš" <mo...@centrum.cz>
>>> Datum: 21.03.2016 14:56
>>> Předmět: Re: [CMake] EFFECTIVE_PLATFORM_NAME not expanded in TARGET_* 
>>> generator expressions on iOS
>>>
>>> CC: cmake@cmake.org
>>> On 21-Mar-16 19:42, Vladimír Vondruš wrote:
>>>> Hello,
>>>>
>>>> I came across this problem when trying to use XCTest macros ( 
>>>> https://cmake.org/cmake/help/latest/module/FindXCTest.html ) on iOS. When 
>>>> compiling for OSX, ctest properly executes all test cases, but when 
>>>> targeting iOS or iOS simulator, all the test cases fail similarly to the 
>>>> following:
>>>>
>>>>       25: Test command: 
>>>> /Applications/Xcode.app/Contents/Developer/usr/bin/xctest 
>>>> "/Users/mosra/Code/corrade/build-ioss/src/Corrade/Utility/Test/Debug${EFFECTIVE_PLATFORM_NAME}/UtilityTypeTraitsTestRunner.xctest/../.."
>>>>       25: Environment variables:
>>>>       25:  
>>>> DYLD_FRAMEWORK_PATH=/Users/mosra/Code/corrade/build-ioss/src/Corrade/Utility/Test/Debug${EFFECTIVE_PLATFORM_NAME}/UtilityTypeTraitsTest.framework/..
>>>>       25: Test timeout computed to be: 9.99988e+06
>>>>       25: 2016-03-21 12:41:38.799 xctest[31113:31078264] The bundle “Test” 
>>>> couldn’t be loaded because its executable couldn’t be located. Try 
>>>> reinstalling the bundle.
>>>>       25/28 Test #25: UtilityTypeTraitsTest ...............***Failed    
>>>> 0.04 sec
>>>>
>>>> As you can see, the `${EFFECTIVE_PLATFORM_NAME}` is not being expanded to 
>>>> `-iphonesimulator` and thus the file is not found. The problem is that the 
>>>> `$<TARGET_LINKER_FILE_DIR:target>` generator expression does not expand 
>>>> the variable. On the other hand, installation works without an issue, 
>>>> because the `cmake_install.cmake` scripts do additional round of variable 
>>>> expansion that (accidentally?) fixes this. The relevant part of the CMake 
>>>> source is here: 
>>>> https://github.com/Kitware/CMake/blob/cd569b962dbeaa7ea718021c16582cddd158df3a/Source/cmGeneratorTarget.cxx#L5063
>>>>
>>>>   From the source it looks like the generator is just putting the 
>>>> "${EFFECTIVE_PLATFORM_NAME}" output and hopes that someone later expands 
>>>> it. That's the case with install scripts (so they work), but not with 
>>>> generator expressions. The `TARGET_LINKER_FILE_DIR` is not the only 
>>>> affected, the problem is the same for all `TARGET_*` generator expressions.
>>>>
>>>> Currently I'm working around this by partially hardcoding the path, but 
>>>> that's far from ideal and I would like to avoid that:
>>>>
>>>>       if(CMAKE_OSX_SYSROOT MATCHES "iPhoneOS")
>>>>           set(platform_name "-iphoneos")
>>>>       elseif(CMAKE_OSX_SYSROOT MATCHES "iPhoneSimulator")
>>>>           set(platform_name "-iphonesimulator")
>>>>       endif()
>>>>       set(target_linker_file_dir 
>>>> ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>${platform_name}/${target}.xctest)
>>>>
>>>> Is there any way to fix this directly in CMake? Also the above workaround 
>>>> works only when targeting single SDK and not when having single generated 
>>>> project for both the device and the simulator.
>>>>
>>>> Thank you a lot for your help.
>>>>
>>>> mosra
>>> I doubt I can help with the problem but just for your information:
>>> * it wasn't fixed "accidentally", it was a fix for #12506:
>>> https://github.com/Kitware/CMake/commit/48fe617e667d2e6b1e471cfb56346de51f984ba5
>>> * there is no "additional round" of variable expansion,
>>> EFFECTIVE_PLATFORM_NAME initialized from Xcode's environment variable
>>> EFFECTIVE_PLATFORM_NAME on installation
>>>
>>> As far as I understand the main general problem with iOS
>>> device/simulator support is that CMake doesn't have multi-toolchain
>>> feature from the box. So for now all this stuff worked by generating
>>> some "universal" code that do work for both SDKs. The real SDK can be
>>> triggered by additional explicit option, i.e.:
>>> * cmake --build _builds -- -sdk iphoneos # trigger iphoneos SDK
>>> * cmake --build _builds -- -sdk iphonesimulator # trigger
>>> iphonesimulator SDK
>>>
>>> Ruslo
>>>
>
>
-- 

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