Hi Alan,
with cmake 2.8.12.1 I can confirm this behavior at least for Makefile
generator on Linux, see the attached small CMakeLists.txt. But what
would be a better behavior? Changing the target name would change the
output at end. So the user would have to figure out, what changed why.
At this point, I would prefer the current behavior, because cmake does
at least with the Makefile generator, the same thing as the user writes.
So the warning is appropriate.
Andreas
Am 02.11.2014 18:30, schrieb Alan W. Irwin:
Eike said:
Because you can't create files or directories with that name, you
would end up getting one directory "tests" and a file/directory
win32_test*. And
creating both with one API call isn't possible, so this may work if
there is a directory "tests" before because of some other reason, but
it will not reliably work.
Hi Eike:
I just want to confirm something about your answer. The OP
was getting complaints about a _target_ with a slash in the name. At
the CMake level there is a huge distinction between targets and files.
Are you saying that at least for some generators a target eventually
ends up as a filename (e.g., at the configured Makefile level) with
exactly the same name as the target so a slash propagates to that
filename? I
agree if that were the case, it could cause issues on Unix platforms
if the "directory" portion of the filename was not independently
created first.
If this is actually the case, I am somewhat surprised that CMake
exposes such implementation details at the CMake level. For example,
it should be possible to use a unique hash of target names when
creating the corresponding configured filename such that the filename
does not include any characters such as "/" that have special meaning
at the file level on some platforms.
Alan
__________________________
Alan W. Irwin
Astronomical research affiliation with Department of Physics and
Astronomy,
University of Victoria (astrowww.phys.uvic.ca).
Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________
Linux-powered Science
__________________________
project(testSlash)
cmake_minimum_required(VERSION 2.8)
file(WRITE "main.c" "int main() { return 0; }")
add_executable(testDir/TestExe main.c)
--
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