[cmake-developers] ExternalProject: Use native paths as substitute for directory tokens

Kislinskiy, Stefan s.kislinskiy at Dkfz-Heidelberg.de
Thu Aug 20 05:02:14 EDT 2015


Hi David,

thank you for the fast feedback. Do you have an example where a native path does not work as path here? As the current solution is not correct (a more specific example is following), I am still absolutely convinced that it must be fixed somehow. If you would categorize the fix as an API-breaking change, what are the options? - A new CMake policy?

Example excerpt (it is not possible to change the working directory for the CONFIGURE_COMMAND as it is fixed to the BUILD_DIR, which might not be sufficient):

set(bootstrap_cmd "<SOURCE_DIR>/bootstrap${shell_ext}" ${bootstrap_toolset})

if(WIN32)
  set(bootstrap_cmd pushd "<SOURCE_DIR>" COMMAND ${bootstrap_cmd} COMMAND popd)
endif()

ExternalProject_Add(Boost
  ...
  CONFIGURE_COMMAND ${bootstrap_cmd}
  ...
)

One would need to write workarounds to get this working currently, for example, set CONFIGURE_COMMAND to "" and add a custom step which allows for a user specified WORKING_DIRECTORY or rewrite the directory token replacement locally. But both workarounds would only resolve the symptoms, not the actual problem that might occur in another example.

Best regards,
Stefan
________________________________________
Von: David Cole [DLRdave at aol.com]
Gesendet: Donnerstag, 20. August 2015 05:27
An: Kislinskiy, Stefan
Cc: cmake-developers at cmake.org
Betreff: Re: [cmake-developers] ExternalProject: Use native paths as substitute for directory tokens

But some existing replacements require forward slashes, we can't just "to native path" everything blindly. I think you will have to special case the bits which do need native paths.


On Wednesday, August 19, 2015, Kislinskiy, Stefan <s.kislinskiy at dkfz-heidelberg.de<mailto:s.kislinskiy at dkfz-heidelberg.de>> wrote:
Hi,

I would like to contribute a fix regarding directory tokens (e.g. <SOURCE_DIR>) in the ExternalProject module. These tokens are replaced by their matching target property value _EP_${dir}. However, the path substitutes are not converted to native path style which makes it impossible to use directory tokens in some Windows commands like pushd, as these commands are not able to handle forward slashes. I attached a tiny patch which simply calls file(TO_NATIVE_PATH) before replacing directory tokens.

Best regards,
Stefan Kislinskiy


More information about the cmake-developers mailing list