MantisBT - CMake
View Issue Details
0015781CMakeCMakepublic2015-10-11 14:372016-03-07 09:12
Jeeves 
 
lowfeatureN/A
closedfixed 
CMake 3.3.2 
CMake 3.5CMake 3.5 
0015781: FindFlex should have a DEFINES_FILE option in analogue with FIndBison
Flex, like Bison, has the option to use a custom header name (%option header-file="...") which if employed means that FLEX_TARGET built files don't get properly cleaned.

To fix this, the macro FLEX_TARGET should have the same DEFINES_FILE option as BISON_TARGET, to override the default header file name.
No tags attached.
diff flex-target-header-support.diff (5,051) 2015-10-11 16:22
https://public.kitware.com/Bug/file/5538/flex-target-header-support.diff
diff flex-target-header-support-v2.diff (5,934) 2015-10-11 16:43
https://public.kitware.com/Bug/file/5539/flex-target-header-support-v2.diff
diff flex-target-header-support-v3.diff (7,506) 2015-10-17 12:37
https://public.kitware.com/Bug/file/5547/flex-target-header-support-v3.diff
diff flex-target-header-support-v4.diff (7,281) 2015-10-17 12:55
https://public.kitware.com/Bug/file/5548/flex-target-header-support-v4.diff
diff flex-target-header-support-v5.diff (7,323) 2015-10-19 13:00
https://public.kitware.com/Bug/file/5550/flex-target-header-support-v5.diff
Issue History
2015-10-11 14:37JeevesNew Issue
2015-10-11 16:22JeevesFile Added: flex-target-header-support.diff
2015-10-11 16:22JeevesNote Added: 0039565
2015-10-11 16:23JeevesNote Edited: 0039565bug_revision_view_page.php?bugnote_id=39565#r1924
2015-10-11 16:43JeevesFile Added: flex-target-header-support-v2.diff
2015-10-11 16:43JeevesNote Added: 0039566
2015-10-12 10:53Brad KingNote Added: 0039574
2015-10-17 12:37JeevesFile Added: flex-target-header-support-v3.diff
2015-10-17 12:38JeevesNote Added: 0039623
2015-10-17 12:55JeevesFile Added: flex-target-header-support-v4.diff
2015-10-17 12:56JeevesNote Added: 0039624
2015-10-19 09:58Brad KingNote Added: 0039629
2015-10-19 11:27JeevesNote Added: 0039634
2015-10-19 11:29JeevesNote Edited: 0039634bug_revision_view_page.php?bugnote_id=39634#r1934
2015-10-19 11:33JeevesNote Edited: 0039634bug_revision_view_page.php?bugnote_id=39634#r1935
2015-10-19 11:44Brad KingNote Added: 0039636
2015-10-19 11:52JeevesNote Added: 0039637
2015-10-19 13:00JeevesFile Added: flex-target-header-support-v5.diff
2015-10-19 13:00JeevesNote Added: 0039638
2015-10-19 13:20Brad KingNote Added: 0039639
2015-10-19 13:20Brad KingStatusnew => resolved
2015-10-19 13:20Brad KingResolutionopen => fixed
2015-10-19 13:20Brad KingFixed in Version => CMake 3.5
2015-10-19 13:20Brad KingTarget Version => CMake 3.5
2016-03-07 09:12Robert MaynardNote Added: 0040624
2016-03-07 09:12Robert MaynardStatusresolved => closed

Notes
(0039565)
Jeeves   
2015-10-11 16:22   
(edited on: 2015-10-11 16:23)
Added a diff for this feature. Also, fix a couple of minor spelling errors.

(0039566)
Jeeves   
2015-10-11 16:43   
Added a second version of the diff, since I noticed I forgot to update the runtime macro usage. Sigh.
(0039574)
Brad King   
2015-10-12 10:53   
Thanks! Please split the patch up to port to cmake_parse_arguments first and then make the functional change. The updates to FindBISON were done the same way:

 FindBISON: Use CMAKE_PARSE_ARGUMENTS to parse arguments
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=eb859263 [^]

 FindBISON: Add DEFINES_FILE option to pass --defines=FILE
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=12e534c2 [^]
(0039623)
Jeeves   
2015-10-17 12:38   
Uploaded a new version of the diff with commits separated in to adding CMAKE_PARSE_ARGUMENTS and the functional change. Sorry it took so long, I was rather busy this week.
(0039624)
Jeeves   
2015-10-17 12:56   
... and as soon as I upload it, I spot a problem with it. Uploaded a new version that's actually correct.
(0039629)
Brad King   
2015-10-19 09:58   
Thanks. I just noticed that the change does not actually modify the flex command invoked. Is this just about getting the already-generated file to be listed as an output of the custom command?
(0039634)
Jeeves   
2015-10-19 11:27   
(edited on: 2015-10-19 11:33)
Yes. It assumes that either you've specified the header output file name in the flex source file with %option header-file or you're passing the --header-file command line option with COMPILE_FLAGS. I could modify it to add the --header-file option to the command line if you think that's best, which I guess would decrease redundancy at the cost of also reducing flexibility.

(0039636)
Brad King   
2015-10-19 11:44   
Re 0015781:0039634: The bison version passes an explicit --defines=... option using the DEFINES_FILE argument value. I see no equivalent to this change here. Shouldn't we add --header-file= ?
(0039637)
Jeeves   
2015-10-19 11:52   
I guess thinking about it, probably. I'm mostly going by my own usage since I specify all the command line options in the source file, given that there are quite a few of them. The only thing is that options specified in the source actually override options specified on the command line, which is a little counter-intuitive. I'll fix it.
(0039638)
Jeeves   
2015-10-19 13:00   
Done.
(0039639)
Brad King   
2015-10-19 13:20   
Thanks. Applied with minor tweaks:

 FindFLEX: Use CMAKE_PARSE_ARGUMENTS to parse arguments
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=30710b8d [^]

 FindFLEX: Fix typo in ADD_FLEX_BISON_DEPENDENCY errors
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c26ff8a9 [^]

 FindFLEX: Add a DEFINES_FILE option to specify flex-generated header
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=db3d8505 [^]
(0040624)
Robert Maynard   
2016-03-07 09:12   
Closing resolved issues that have not been updated in more than 4 months.