Re: [cmake-developers] [PATCH] Discussion needed: FindBISON: refine VERBOSE feature of BISON_TARGET

2016-11-14 Thread Brad King
On 07/18/2016 09:14 AM, Brad King wrote:
>  FindBISON: Change usage of [VERBOSE ] to [VERBOSE []]
>  https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ad2497aa

BTW, this caused a regression reported here:

* https://gitlab.kitware.com/cmake/cmake/issues/16426

Please take a look at the fix here:

* https://gitlab.kitware.com/cmake/cmake/merge_requests/250

Thanks,
-Brad
-- 

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


Re: [cmake-developers] [PATCH] Discussion needed: FindBISON: refine VERBOSE feature of BISON_TARGET

2016-07-18 Thread Brad King
On 07/15/2016 02:14 PM, Eon Jeong wrote:
> I wrote new patches for each of: changing usage of VERBOSE, new option
> REPORT_FILE, and refactoring all of them.

Thanks, applied:

 FindBISON: Change usage of [VERBOSE ] to [VERBOSE []]
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ad2497aa

 FindBISON: Add REPORT_FILE option to pass --report-file=FILE
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c42e63a9

 FindBISON: Refactor public and inner macro routines
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ab8d5d0f

-Brad

-- 

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


Re: [cmake-developers] [PATCH] Discussion needed: FindBISON: refine VERBOSE feature of BISON_TARGET

2016-07-15 Thread Eon Jeong
I wrote new patches for each of: changing usage of VERBOSE, new option
REPORT_FILE, and refactoring all of them.


0001-FindBISON-Change-usage-of-VERBOSE-file-to-VERBOSE-fi.patch
Description: Binary data


0002-FindBISON-Add-REPORT_FILE-option-to-pass-report-file.patch
Description: Binary data


0003-FindBISON-Refactor-public-and-inner-macro-routines.patch
Description: Binary data
-- 

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

Re: [cmake-developers] [PATCH] Discussion needed: FindBISON: refine VERBOSE feature of BISON_TARGET

2016-07-15 Thread Ben Boeckel
On Fri, Jul 15, 2016 at 10:52:23 -0400, Brad King wrote:
> On 07/15/2016 10:45 AM, Eon Jeong wrote:
> > I considered that way, but doing this can't figure "VERBOSE" used
> > without  from never used. same empty string value.
> 
> You could hack it with something like
> 
>   if("${ARGN}" MATCHES ";VERBOSE;")
> 
> if the value comes back empty.

Avoiding regexes here would be better:

list(FIND ARGN "VERBOSE" has_verbose)

--Ben
-- 

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


Re: [cmake-developers] [PATCH] Discussion needed: FindBISON: refine VERBOSE feature of BISON_TARGET

2016-07-15 Thread Eon Jeong
Thanks Brad, I'll try with that hack.

Eon
-- 

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


Re: [cmake-developers] [PATCH] Discussion needed: FindBISON: refine VERBOSE feature of BISON_TARGET

2016-07-15 Thread Brad King
On 07/15/2016 10:45 AM, Eon Jeong wrote:
> I considered that way, but doing this can't figure "VERBOSE" used
> without  from never used. same empty string value.

You could hack it with something like

  if("${ARGN}" MATCHES ";VERBOSE;")

if the value comes back empty.

-Brad

-- 

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


Re: [cmake-developers] [PATCH] Discussion needed: FindBISON: refine VERBOSE feature of BISON_TARGET

2016-07-15 Thread Brad King
On 07/15/2016 10:35 AM, Eon Jeong wrote:
> [VERBOSE []] was my hope, but it's not easy. Since FindBISON now
> uses CMakeParseArguments, a keyword can't be used both as an option
> and as a one-value keyword.

Just make it a multi-value keyword and then reject multiple values
manually after cmake_parse_arguments returns.

-Brad

-- 

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


Re: [cmake-developers] [PATCH] Discussion needed: FindBISON: refine VERBOSE feature of BISON_TARGET

2016-07-15 Thread Eon Jeong
2016-07-15 23:38 GMT+09:00 Brad King :
> Just make it a multi-value keyword and then reject multiple values
> manually after cmake_parse_arguments returns.

I considered that way, but doing this can't figure "VERBOSE" used
without  from never used. same empty string value.

Eon
-- 

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


Re: [cmake-developers] [PATCH] Discussion needed: FindBISON: refine VERBOSE feature of BISON_TARGET

2016-07-15 Thread Eon Jeong
Thank you clarifying the basic rules.

2016-07-15 22:33 GMT+09:00 Brad King :
>> 3.5. [VERBOSE []] and [REPORT_FILE ]. In this case, 
>> argument of [VERBOSE ] can be either ignored or used (copying
>> the report file.) This does not break compatibility at all
>
> I think this is the best solution.  One could also reject use of
> both  options at the same time.

[VERBOSE []] was my hope, but it's not easy. Since FindBISON now
uses CMakeParseArguments, a keyword can't be used both as an option
and as a one-value keyword.

Possible solutions are:

- Splitting [VERBOSE ] into [VERBOSE] (just `--verbose`) and
[VERBOSE_FILE ] (`--verbose` and copy). It breaks the
compatibility slightly, but I think this is an approvable break even
without REPORT_FILE because there was no choice to get just
default-named output file. In this case, "VERBOSE", "VERBOSE
REPORT_FILE " or "VERBOSE_FILE " or any combinations can
be used.

- Let [VERBOSE ] and [REPORT_FILE ] independently exist.
[VERBOSE ] means `--verbose` and copying to , and
[REPORT_FILE ] means `--report-file ` *and `--verbose`*.
cf. In bison, `--report-file ` does not imply `--verbose`.

- Extending CMakeParseArguments so a one-value keyword can be also
used as options when it's passed both in  and
. Then combinations "VERBOSE", "VERBOSE ",
"VERBOSE REPORT_FILE ", "VERBOSE  REPORT_FILE " can
be used.

- Not using CMakeParseArguments.

Sorry for making mistake. I was thinking wrong about how
CMakeParseArguments works.

Thanks,

Eon
-- 

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


Re: [cmake-developers] [PATCH] Discussion needed: FindBISON: refine VERBOSE feature of BISON_TARGET

2016-07-15 Thread Brad King
On 07/15/2016 04:51 AM, Eon Jeong wrote:
> review past discussion on this issue.

Thanks for summarizing.

> 3.5. [VERBOSE []] and [REPORT_FILE ]. In this case, 
> argument of [VERBOSE ] can be either ignored or used (copying
> the report file.) This does not break compatibility at all

I think this is the best solution.  One could also reject use of
both  options at the same time.

> - Behavioral & syntactic compatibility of [VERBOSE ] between
> before and after the patch.

We need to remain compatible with users of [VERBOSE ].

> - If we add [REPORT_FILE ], it does not work on systems using
> bison before 2007. We may care it with custom command using `move`, or
> not.

If a project chooses to use REPORT_FILE then it is implying a dependency
on a sufficiently new version of bison, not CMake.  This is fine.

Thanks,
-Brad

-- 

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


Re: [cmake-developers] [PATCH] Discussion needed: FindBISON: refine VERBOSE feature of BISON_TARGET

2016-07-15 Thread Eon Jeong
This mail is not bound to thread because of my mistake. The original
thread is [PATCH] Discussion needed: FindBISON: refine VERBOSE feature
of BISON_TARGET
.
Any review should be made on the thread.
-- 

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


Re: [cmake-developers] [PATCH] Discussion needed: FindBISON: refine VERBOSE feature of BISON_TARGET

2016-07-15 Thread Eon Jeong
A year passed so long to reply for a personal reason.

Adding to this list because I think it's better to review past
discussion on this issue.

So let's clearify:

1. Current [VERBOSE ] defines `--verbose`, so bison generates
foo.output from foo.y, (generating also foo.tab.c and foo.tab.h) then
cmake copies foo.output to . It's intermediate-file-and-copy as
said. It's also problematic because using [VERBOSE ] forces the
report file to be copied to some other name.

2. Since 2007, bison has `--report-file ` option that specifies
the report file name instead of foo.output. so [REPORT_FILE ] is
suggested. No intermediate file is made; so using this breaks
behavioral backward compatibility. On the other hand, some build
systems are still using bison of version before 2007.

3. There are some candidates replacing current [VERBOSE ]:

3.1. No change for our FindBISON module. `--report-file ` option
can be used via COMPILE_FLAGS. Hint this in documentation.

3.2. [VERBOSE []]. This does not break backward compatibility,
and makes someone can choose the report file is copied or not.

3.4. Just [VERBOSE] and [REPORT_FILE ]. Independently, [VERBOSE]
inserts `--verbose`, [REPORT_FILE ] inserts `--report_file
`. No more intermediate-file-and-copy, so breaking
compatibility, but the clearest solution.

3.5. [VERBOSE []] and [REPORT_FILE ]. In this case, 
argument of [VERBOSE ] can be either ignored or used (copying
the report file.) This does not break compatibility at all, but it's
dirty when [REPORT_FILE ] is cared for lower versions of bison
using `cmake -E copy` because [VERBOSE ] does the exact thing.

And many other solutions possible.

4. Issues are:

- Behavioral & syntactic compatibility of [VERBOSE ] between
before and after the patch.

- If we remove  from [VERBOSE ] so it becomes [VERBOSE],
syntactic compatibility breaks.

- If we add [REPORT_FILE ], it does not work on systems using
bison before 2007. We may care it with custom command using `move`, or
not.

These issues are about how CMake cares about the modules'
compatibility and clearness, so I need some direction.

I will make appropriate patch for the result.

Thanks,

Eon

2015-06-25 0:29 GMT+09:00 Brad King :
> On 06/24/2015 11:13 AM, 정언 wrote:
>> The copying command should be run right after each execution of bison.
>
> Yes.
>
>> However, add_custom_command never guarantees a running order of
>> internal commands. The documentation says, the commands can run
>> parallel so never ever put commands with implicit dependencies.
>
> I'm not sure what text from the documentation you're referencing,
> but I think that is warning about listing one output in multiple
> independent targets, e.g.
>
>  add_custom_command(OUTPUT out.txt ...)
>  add_custom_target(tgt1 DEPENDS out.txt)
>  add_custom_target(tgt2 DEPENDS out.txt)
>
> That is not the case here.
>
>> Again, we have two custom commands as a result of passing `VERBOSE` to
>> bison_target(). One runs bison, and the other runs cp.
>
> We only need one add_custom_command call.  It can list both outputs
> and have two COMMAND arguments.  Something like (untested):
>
>   if(...)
> set(_maybe_copy_verbose_output ${BISON_TARGET_ARG_VERBOSE})
> set(_maybe_copy_verbose_command
>   COMMAND ${CMAKE_COMMAND} -E copy 
> ${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output 
> ${BISON_TARGET_ARG_VERBOSE}
>   )
>   endif()
>
>   add_custom_command(OUTPUT ${BISON_TARGET_outputs} 
> ${_maybe_copy_verbose_output}
> ${BISON_TARGET_extraoutputs}
> COMMAND ${BISON_EXECUTABLE} ${BISON_TARGET_cmdopt} -o ${BisonOutput} 
> ${BisonInput}
> ${_maybe_copy_verbose_command}
> DEPENDS ${BisonInput}
> COMMENT "[BISON][${Name}] Building parser with bison ${BISON_VERSION}"
> WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
>
> When both COMMAND options are present they will run sequentially.
>
>> If VERBOSE behaved right, REPORT_FILE would not have any benefits over it.
>
> Wouldn't it be able to skip the intermediate file and copy step?
>
> -Brad
>



-- 
Eon Jeong 
Seoul, Rep. of Korea
Undergrad @ Dept.of Computer Science and Communication Engineering, Korea Univ.
-- 

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

Re: [cmake-developers] [PATCH] Discussion needed: FindBISON: refine VERBOSE feature of BISON_TARGET

2016-07-15 Thread Eon Jeong
A year passed so long to reply for a personal reason.

Adding to this list because I think it's better to review past
discussion on this issue.

So let's clearify:

1. Current [VERBOSE ] defines `--verbose`, so bison generates
foo.output from foo.y, (generating also foo.tab.c and foo.tab.h) then
cmake copies foo.output to . It's intermediate-file-and-copy as
said. It's also problematic because using [VERBOSE ] forces the
report file to be copied to some other name.

2. Since 2007, bison has `--report-file ` option that specifies
the report file name instead of foo.output. so [REPORT_FILE ] is
suggested. No intermediate file is made; so using this breaks
behavioral backward compatibility. On the other hand, some build
systems are still using bison of version before 2007.

3. There are some candidates replacing current [VERBOSE ]:

3.1. No change for our FindBISON module. `--report-file ` option
can be used via COMPILE_FLAGS. Hint this in documentation.

3.2. [VERBOSE []]. This does not break backward compatibility,
and makes someone can choose the report file is copied or not.

3.4. Just [VERBOSE] and [REPORT_FILE ]. Independently, [VERBOSE]
inserts `--verbose`, [REPORT_FILE ] inserts `--report_file
`. No more intermediate-file-and-copy, so breaking
compatibility, but the clearest solution.

3.5. [VERBOSE []] and [REPORT_FILE ]. In this case, 
argument of [VERBOSE ] can be either ignored or used (copying
the report file.) This does not break compatibility at all, but it's
dirty when [REPORT_FILE ] is cared for lower versions of bison
using `cmake -E copy` because [VERBOSE ] does the exact thing.

And many other solutions possible.

4. Issues are:

- Behavioral & syntactic compatibility of [VERBOSE ] between
before and after the patch.

- If we remove  from [VERBOSE ] so it becomes [VERBOSE],
syntactic compatibility breaks.

- If we add [REPORT_FILE ], it does not work on systems using
bison before 2007. We may care it with custom command using `move`, or
not.

These issues are about how CMake cares about the modules'
compatibility and clearness, so I need some direction.

I will make appropriate patch for the result.

Thanks,

Eon

2016-07-15 17:42 GMT+09:00 Eon Jeong :
> Sorry, resending on list.
>
> 2016-07-15 17:42 GMT+09:00 Eon Jeong :
>> A year passed so long to reply for a personal reason.
>>
>> Adding to this list because I think it's better to review past
>> discussion on this issue.
>>
>> So let's clearify:
>>
>> 1. Current [VERBOSE ] defines `--verbose`, so bison generates
>> foo.output from foo.y, (generating also foo.tab.c and foo.tab.h) then
>> cmake copies foo.output to . It's intermediate-file-and-copy as
>> said. It's also problematic because using [VERBOSE ] forces the
>> report file to be copied to some other name.
>>
>> 2. Since 2007, bison has `--report-file ` option that specifies
>> the report file name instead of foo.output. so [REPORT_FILE ] is
>> suggested. No intermediate file is made; so using this breaks
>> behavioral backward compatibility. On the other hand, some build
>> systems are still using bison of version before 2007.
>>
>> 3. There are some candidates replacing current [VERBOSE ]:
>>
>> 3.1. No change for our FindBISON module. `--report-file ` option
>> can be used via COMPILE_FLAGS. Hint this in documentation.
>>
>> 3.2. [VERBOSE []]. This does not break backward compatibility,
>> and makes someone can choose the report file is copied or not.
>>
>> 3.4. Just [VERBOSE] and [REPORT_FILE ]. Independently, [VERBOSE]
>> inserts `--verbose`, [REPORT_FILE ] inserts `--report_file
>> `. No more intermediate-file-and-copy, so breaking
>> compatibility, but the clearest solution.
>>
>> 3.5. [VERBOSE []] and [REPORT_FILE ]. In this case, 
>> argument of [VERBOSE ] can be either ignored or used (copying
>> the report file.) This does not break compatibility at all, but it's
>> dirty when [REPORT_FILE ] is cared for lower versions of bison
>> using `cmake -E copy` because [VERBOSE ] does the exact thing.
>>
>> And many other solutions possible.
>>
>> 4. Issues are:
>>
>> - Behavioral & syntactic compatibility of [VERBOSE ] between
>> before and after the patch.
>>
>> - If we remove  from [VERBOSE ] so it becomes [VERBOSE],
>> syntactic compatibility breaks.
>>
>> - If we add [REPORT_FILE ], it does not work on systems using
>> bison before 2007. We may care it with custom command using `move`, or
>> not.
>>
>> These issues are about how CMake cares about the modules'
>> compatibility and clearness, so I need some direction.
>>
>> I will make appropriate patch for the result.
>>
>> Thanks,
>>
>> Eon
>>
>> 2015-06-25 0:29 GMT+09:00 Brad King :
>>> On 06/24/2015 11:13 AM, 정언 wrote:
 The copying command should be run right after each execution of bison.
>>>
>>> Yes.
>>>
 However, add_custom_command never guarantees a running order of
 internal commands. The documentation says, the commands can run
 parallel so never ever put commands with implicit dependencies.
>>>
>>> 

Re: [cmake-developers] [PATCH] Discussion needed: FindBISON: refine VERBOSE feature of BISON_TARGET

2015-06-24 Thread Brad King
On 06/24/2015 11:13 AM, 정언 wrote:
> The copying command should be run right after each execution of bison.

Yes.

> However, add_custom_command never guarantees a running order of
> internal commands. The documentation says, the commands can run
> parallel so never ever put commands with implicit dependencies.

I'm not sure what text from the documentation you're referencing,
but I think that is warning about listing one output in multiple
independent targets, e.g.

 add_custom_command(OUTPUT out.txt ...)
 add_custom_target(tgt1 DEPENDS out.txt)
 add_custom_target(tgt2 DEPENDS out.txt)

That is not the case here.

> Again, we have two custom commands as a result of passing `VERBOSE` to
> bison_target(). One runs bison, and the other runs cp.

We only need one add_custom_command call.  It can list both outputs
and have two COMMAND arguments.  Something like (untested):

  if(...)
set(_maybe_copy_verbose_output ${BISON_TARGET_ARG_VERBOSE})
set(_maybe_copy_verbose_command
  COMMAND ${CMAKE_COMMAND} -E copy 
${BISON_TARGET_output_path}/${BISON_TARGET_output_name}.output 
${BISON_TARGET_ARG_VERBOSE}
  )
  endif()

  add_custom_command(OUTPUT ${BISON_TARGET_outputs} 
${_maybe_copy_verbose_output}
${BISON_TARGET_extraoutputs}
COMMAND ${BISON_EXECUTABLE} ${BISON_TARGET_cmdopt} -o ${BisonOutput} 
${BisonInput}
${_maybe_copy_verbose_command}
DEPENDS ${BisonInput}
COMMENT "[BISON][${Name}] Building parser with bison ${BISON_VERSION}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

When both COMMAND options are present they will run sequentially.

> If VERBOSE behaved right, REPORT_FILE would not have any benefits over it.

Wouldn't it be able to skip the intermediate file and copy step?

-Brad

-- 

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

Re: [cmake-developers] [PATCH] Discussion needed: FindBISON: refine VERBOSE feature of BISON_TARGET

2015-06-24 Thread 정언
2015-06-22 22:39 GMT+09:00 Brad King :
> On 06/21/2015 09:06 AM, 정언 wrote:
>> internal macro defines a custom command that makes a copy of the
>> default named report file to the specified  path. The custom
>> command is not invoked until any other command requires the ,
>> for example, from its dependencies.
>
> This could be fixed by moving the copy logic to a second COMMAND
> argument to the add_custom_command for the actual bison invocation.

This can't be a solution.

Suppose we have a bison file `foo.y`. We get `foo.tab.c` and
`foo.tab.h` (in default) as a result of running bison, and
additionally `foo.output` if we put `--verbose`. What we need is, for
example, `foo.verbose` with the same content as `foo.output`.
The copying command should be run right after each execution of bison.
However, add_custom_command never guarantees a running order of
internal commands. The documentation says, the commands can run
parallel so never ever put commands with implicit dependencies.
Please see <
http://www.cmake.org/cmake/help/v3.3/command/add_custom_command.html>
for details.

Again, we have two custom commands as a result of passing `VERBOSE` to
bison_target(). One runs bison, and the other runs cp. The former one
produces header and source, BISON_${Name}_OUTPUTS. That's all, and
most of targets are only dependent on them. Even FindFLEX example
does:

Please see the last example with add_executable(). So, in many cases
we don't have any dependencies over the file by VERBOSE, the latter
command (cp) will never run.
How about making the former command dependent on the latter one? Doing
that causes circular dependencies, because the latter is obviously
dependent on the former, by `foo.output`.

To avoid circular dependencies, we might have three custom commands in
total; the first runs bison; the second runs cp which is dependent on
the first; the third is dependent on the first and on the second.
However, dependencies over BISON_${Name}_OUTPUTS would run the first
one only.
Or using add_custom_target? I'm not sure.

I think VERBOSE can't be fixed to behave right.

And this:

> I think that can be added as a separate REPORT_FILE option that is
> considered separately from the VERBOSE option and uses --report-file.
> It could be an error if the discovered bison tool does not support
> the option.

I think what I intended is misunderstood because of my poor
explanation; my fault.

If VERBOSE behaved right, REPORT_FILE would not have any benefits over
it. But it doesn't. Should we keep VERBOSE not changed in this case,
so almost same functionalities defined duplicate? I'm not sure either.

Thanks.
Eon​
-- 

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

Re: [cmake-developers] [PATCH] Discussion needed: FindBISON: refine VERBOSE feature of BISON_TARGET

2015-06-22 Thread Brad King
On 06/21/2015 09:06 AM, 정언 wrote:
> internal macro defines a custom command that makes a copy of the
> default named report file to the specified  path. The custom
> command is not invoked until any other command requires the ,
> for example, from its dependencies.

This could be fixed by moving the copy logic to a second COMMAND
argument to the add_custom_command for the actual bison invocation.

> It is possible to specify a non-default report file path in command
> line. The bison command line option `--report-file` is used to do
> that.

I think that can be added as a separate REPORT_FILE option that is
considered separately from the VERBOSE option and uses --report-file.
It could be an error if the discovered bison tool does not support
the option.

Thanks,
-Brad

-- 

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

[cmake-developers] [PATCH] Discussion needed: FindBISON: refine VERBOSE feature of BISON_TARGET

2015-06-21 Thread 정언
Please look over description of BISON_TARGET macro of FindBISON. It's
availabie in 
for 3.3(currently 3.3.0-rc2).

It says:
BISON_TARGET(   [VERBOSE ]
[COMPILE_FLAGS ])
Specifying `VERBOSE ` makes a report (description) file on
parser is generated.

In fact, current BISON_TARGET does not. VERBOSE adds the bison command
line option `-v`(--verbose). As this option has no extra space for the
file name, bison generates a report file of default name. Instead, the
internal macro defines a custom command that makes a copy of the
default named report file to the specified  path. The custom
command is not invoked until any other command requires the ,
for example, from its dependencies. The  is aliased
BISON_${Name}_VERBOSE_FILE. This is nowhere documented behavior and
should be fixed.

It is possible to specify a non-default report file path in command
line. The bison command line option `--report-file` is used to do
that. For use of this, these are what should be considered:
- (C1) `--report-file` does not generate a report file; it specifies
path of the report file if it is generated. `--report` or `--verbose`
does generate a report file. Considering this means that the main
internal custom command of BISON_TARGET no more recognizes the report
file as one of its outputs. If some  is passed for
`--report-file` but never generated, the main command would run again
and again because it would fail to generate the nonexistent report
file.
- (C2) `--report-file` is added to bison in 2007. (See GNU bison
upstream commit 1bb2bd75
.)
Another patch I submitted was one using `--defines` to specify a
non-default header name, which is available in bison since 2001. (See
commit 6526f6d .)
As GNU bison is widely used since the late 1980's, `--report-file` can
be unavailable for a large amount of systems. For these systems, the
current copying way is appropriate.
(C1) is a consideration which includes (C2), as (C1) implies including
`--report-file` usage.

Any adjustment on BISON_TARGET would harm backward compatibility. Here
are some possible solutions.
- (S1) Updating the documentation only, leaving current behavior unchanged.
- (S2) Changing `[VERBOSE ]` to `[VERBOSE []]`. `VERBOSE`
would add `--verbose`, and specifying `` would add additional
`--report-file`. I think this is the best solution. However, FindBISON
uses CMAKE_PARSE_ARGUMENTS, which does not support formatting
parameters in this way. It means that it is required to remove
CMAKE_PARSE_ARGUMENTS to implement this solution. (Consider
BISON_TARGET recently moved to CMAKE_PARSE_ARGUMENTS. See thread

for details.)
- (S2+) `[VERBOSE [REPORT_FILE ]]` to tell user `` is path
for the report file output. Also impossible with
CMAKE_PARSE_ARGUMENTS. (C2) should be considered.
- (S3) Changing `[VERBOSE ]` to `[VERBOSE]` so it matches the
bison option `--verbose`.
- (S3+) `[VERBOSE] [REPORT_FILE ]`. Each would add its
corresponding command line option described above. `` is
non-default name for report file if generated ever. (C1) should be
considered.
- (S4) Let `[VERBOSE ]` as is, and no more internal custom
command using . This is only for the syntactic backward
compatibility of BISON_TARGET.
- (S4+) `[VERBOSE ] [REPORT_FILE ]`. `VERBOSE` will
generate `` is ignored, and `` is non-default name for
report file if generated ever. (C1) should be considered.
- (S5) Remove `VERBOSE` and leave only `[REPORT_FILE ]`.
`` is non-default name for report file if generated ever. To
generate report file, `--verbose` or `--report` should be specified
via `COMPILE_FLAGS`. (C1) should be considered.

I'm not certain which solution is better than the others, so I wrote
patches for almost all possible solutions. Five patches are attached
in total:
- (current)->(S3).
0001-FindBISON-Change-VERBOSE-option-to-take-no-more-file.patch
- (S3)->(S3+). 0002-FindBISON-Add-REPORT_FILE-option-to-pass-report-file.patch.1
- (current)->(S4).
0001-FindBISON-Change-VERBOSE-option-to-ignore-file-previ.patch
- (S4)->(S4+). 0002-FindBISON-Add-REPORT_FILE-option-to-pass-report-file.patch.2
- (current)->->(S5). 0001-FindBISON-Remove-VERBOSE-option.patch,
0002-FindBISON-Add-REPORT_FILE-option-to-pass-report-file.patch.3
Note that all patches are experimental proof-of-concepts. After a
right solution is chosen, I will write a patch (or more) again for
that, including documentation update.

Thanks,
Eon
-- 

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