On 05-Jul-16 23:26, Brad King wrote:
On 07/05/2016 04:13 PM, Ruslan Baratov wrote:
Works fine on my tests.
Thanks for testing!
However I still vote for using default value for 'fname' instead
of FATAL_ERROR.
I think that behavior would be surprising.
Not such surprising as some error in internal CMake module with no
detail description how it can be fixed. My point is that if it will work
in most cases then why not? Most users will not even notice this.
If something bad will happen user always can use DOWNLOAD_NAME.
Example of the test that will fail with current version but works
fine with default name:
URL "http://tinyurl.com/jn86pmc"
In that case one can just use DOWNLOAD_NAME. Auto-extraction of
the filename from the URL is a convenience for a common case, but
in principle DOWNLOAD_NAME could always be used.
The problem with DOWNLOAD_NAME is about generalizing code. If I have 100
ExternalProject_Add commands with such URLs then I have to add 100
DOWNLOAD_NAME. In my case I have a bunch of templates for
ExternalProject_Add and to introduce this feature either I have:
* test URL for the pattern in similar way CMake do and predict the fact
that CMake will fail to extract name (not stable, what if CMake logic
changed? DRY violation)
* force some name unconditionally like archive.tar (most of the projects
works fine and now for no reason archives will have another names)
* add about 20-30 lines of code to core modules, for each
ExternalProject_Add template add parsing logic and 1 line for each
package version declaration on user side
And all this without introducing any useful features, just to suppress
CMake error for 0.01% of cases.
Anyway I've found workaround that I will use for such URLs. According to
my tests most of the servers ignore fragments in URL and CMake can
extract name from them. E.g. this works:
cmake_minimum_required(VERSION 3.5)
include(ExternalProject)
ExternalProject_Add(
foo
URL "http://tinyurl.com/jn86pmc#a.tar"
URL_HASH SHA1=9c29c30fff99b7c1479b2e9d4926dcc3f8d364e0
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
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-developers