| [ Return to Bugs & Features | SVN ⇄ GIT ]
STR #3415
Application: | FLTK Library |
Status: | 1 - Closed w/Resolution |
Priority: | 3 - Moderate, e.g. unable to compile the software |
Scope: | 2 - Specific to an operating system |
Subsystem: | Build Files |
Summary: | CMake: Programs may need some definitions from FLTK to work correctly |
Version: | 1.4.0 |
Created By: | taeril |
Assigned To: | AlbrechtS |
Fix Version: | 1.4.0 |
Fix Commit: | 81d3ccefa4b6c3cbaeab20231b2c39705dfb3fb8 |
Update Notification: | |
Trouble Report Files:
Trouble Report Comments:
|
#1 | taeril 07:02 Oct 08, 2017 |
| I was playing with fl_filename_isdir to see how it work and my code was based on usage inside FLTK. Just list files and print names, but while I got correct number of entries there was no names! It was cmake build for Linux. More curious same code crosscompiled for windows run OK printing names as expected. Even more interesting slimed down code to report one file compiled by fltk-config worked OK.
As it turns out I need one of: -D_THREAD_SAFE -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE to make it work.
I don't see how I can get those in cmake build so with small change:
diff --git a/CMake/FLTKConfig.cmake.in b/CMake/FLTKConfig.cmake.in index baa25a6..62c8af5 100644 --- a/CMake/FLTKConfig.cmake.in +++ b/CMake/FLTKConfig.cmake.in @@ -13,4 +13,5 @@ set(FLTK_VERSION @FLTK_VERSION_FULL@) include(${CMAKE_CURRENT_LIST_DIR}/FLTK-Targets.cmake)
set(FLTK_INCLUDE_DIRS "@INCLUDE_DIRS@") +set(FLTK_DEFINITIONS "@FLTK_CFLAGS@") set(FLTK_USE_FILE ${CMAKE_CURRENT_LIST_DIR}/UseFLTK.cmake)
I can in my CMakeLists.txt use add_definitions(${FLTK_DEFINITIONS}) and have program working correctly.
Above is what I sent to mailing list some time ago. Attached patch highlights additionally two places documenting that added line, but maybe there is more to say about it?
Tested on Linux with current svn version r12482 | |
|
#2 | taeril 07:12 Oct 08, 2017 |
| I've added simple program showing error. Compiling with cmake shows only numbers - no filenames. Using fltk-config - all is OK. CMakeLists.txt have add_definitions utilizing changes from my patch.
Additionally target_includes_and_definitions.diff make cmake automatically add definitions and include directories making calls to include_directories and add_definitions unnecessary.
https://cmake.org/cmake/help/v2.8.11/cmake.html#section_Commands Based on online documentation 2.8.11 is first version with needed functionality, but I tested it only with cmake 3.9.1 | |
|
#3 | AlbrechtS 08:25 Oct 13, 2017 |
| Thanks for the report and the patches. Our CMake support files are not yet complete, so this will be one step forward.
The patches look good at a first glance. I'll take a closer look later when time permits.
Note: changed subject (aka "Summary") to mark the STR with CMake. | |
|
#4 | AlbrechtS 07:30 Oct 09, 2024 |
| Fixed in Git repository.
Note: I set the git commit as of today as the "Fix Commit" although this issue has been fixed much earlier by the "move to Modern CMake".
I could not reproduce the issue with "no filenames" being listed on current Linux with FLTK 1.4 as of today, using a "Modern CMake" CMakeLists.txt as described in README.CMake.txt.
The only remaining piece I can imagine would be something similar to the patch in https://www.fltk.org/strfiles/3415/target_includes_and_definitions.diff
... but much shorter, just like:
target_compile_definitions(fltk INTERFACE ${FLTK_CFLAGS})
... since all other conditions are met by our current minimum CMake version (3.15) and target_include_directories are set elsewhere.
However, it is not clear which of the `FLTK_CFLAGS` should be exported as INTERFACE_COMPILE_DEFINITIONS as opposed to internal (private) build settings.
Therefore I'm closing this STR now (w/Resolution). If there are any remaining issues, please open a GitHub Issue. | |
[ Return to Bugs & Features ]
|
| |