Bug #2292
closedexamples/CMakeLists.txt resources dir symlink and example run script file name problem
Description
When building with BUILD_EXAMPLES=ON, INSTALL_EXAMPLES=ON cmake generate a run script for the example named 'locale'. As CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE is enabled, the C preprocessor include the script file 'locale' in the build directory instead of the C locale system header file.
With INSTALL_RESOURCES=ON resources folder symlink are created without using the DESTDIR and for the widgetgallery the symlink should be created in widgetgallery/docroot/resources instead of widgetgallery/resources I think as I get an HTTP 404 error for the resources when running the widgetgallery example.
The attached patch add an '.sh' extension to the example run script file name so locale.sh don't get included by the CPP and fix the creation of symlink with a DESTDIR but it doesn't fix the widgetgallery resources symlink location.
Files
Updated by Koen Deforche about 11 years ago
- Status changed from New to InProgress
- Assignee set to Wim Dumon
- Target version set to 3.3.1
Updated by Wim Dumon about 11 years ago
Sounds reasonable. I'm checking with our debian package maintainer to see if he has an issue with it.
Wim.
Updated by Pau Garcia i Quiles about 11 years ago
This is not how I would solve these issues.
First issue: "locale" script being included instead of "locale" header¶
Adding .sh extensions (something I don't like because it's unnecessary on Unix) is a quick workaround but does not really solve the main issue, which is any file with the same name as a C/C header will silently impersonate the intended file.
The proper way to solve this is to build Wt out-of-source-tree (which is in fact what CMake recommends). This way, no "locale" file is generated in the source tree and the compiler will not include a script called locale instead of the header "locale". I guess this is why I have never seen this issue: I always perform out-of-tree builds.
If in-tree builds should be supported, I would rather rename the "locale" example to something else ("timezones"? After all, it doesn't deal with l10n). However, that doesn't address the case that this may happen again in the future.
Second issue: DESTDIR¶
I have not performed a build to check this issue but it's strange I have never seen this, given that for the Debian packages I use DESTDIR and I also use symlinks.
I'd say the proper way to solve this is not prepending ${DESTDIR} (I'd need to test, but I suspect this may cause trouble in some other case) but to make the path relative relative by means of FILE (RELATIVE_PATH ...).
But again, I'd need to test the issue and I've got my plate full with winstng, it takes too much of my spare time already :-/
Updated by Pau Garcia i Quiles about 11 years ago
Mmm it seems I spoke too soon in the 'locale' issue. Now that I'm trying to build Wt SDK on Linux (Ubuntu 12.04 LTS), I'm seeing the same issue, even though I'm using an out-of-tree build directory. Oddly, that does not happen for the Debian packages.
I'm working on it.
Updated by Pau Garcia i Quiles about 11 years ago
OK, now I see why this never happened to me: the 'locale' example is new in 3.3.1, which is yet unreleased.
I am trying to figure why the launcher scripts for the examples are generated in the root of the build directory. I never noticed this is 3.3.0 and earlier versions, which does not mean it was not that way. Building.
Updated by Pau Garcia i Quiles about 11 years ago
Launcher scripts were indeed generated in the root of the build directory in 3.3.0. I think the fix for issue #1 should go in the direction of generating the launcher script in the directory of the example instead of the root of the build directory.
Updated by Pau Garcia i Quiles about 11 years ago
This patch should fix the 'locale' issue:
https://www.assembla.com/code/winstng/git/nodes/wim/patches/wt-3.3.1rc2.patch
(no extension added, launcher scripts are now generated in the example build directory instead of the root build directory)
Next: look at the DESTDIR issue
Updated by Koen Deforche about 11 years ago
- Status changed from InProgress to Resolved
Updated by Koen Deforche about 11 years ago
- Status changed from Resolved to Closed