Re: [cmake-developers] -isystem suppresses warnings from user header

2016-04-07 Thread Tamás Kenéz
Thanks! I missed that property.
Tamas

On Thu, Apr 7, 2016 at 4:13 PM, Brad King  wrote:

> On 04/07/2016 10:03 AM, Tamás Kenéz wrote:
> > CMake uses "-isystem" on the compiler command line for the
> > INTERFACE_INCLUDE_DIRECTORIES of imported libraries.
> >
> > Question: is this the intended behaviour?
>
> Yes.  See discussion here:
>
> * http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/7533
>
> and implementation here:
>
> * Always consider includes from IMPORTED targets to be SYSTEM.
>   https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a63fcbcb
>
> > Can I force the -I flag somehow for my library?
>
> Look at these:
>
> *
> https://cmake.org/cmake/help/v3.5/variable/CMAKE_NO_SYSTEM_FROM_IMPORTED.html
> * https://cmake.org/cmake/help/v3.5/prop_tgt/NO_SYSTEM_FROM_IMPORTED.html
>
> -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] [CMake 0016055]: "nmake" program is not found using MAKE environment variable

2016-04-07 Thread Mantis Bug Tracker

The following issue has been SUBMITTED. 
== 
https://public.kitware.com/Bug/view.php?id=16055 
== 
Reported By:Daniel Richard G.
Assigned To:
== 
Project:CMake
Issue ID:   16055
Category:   CMake
Reproducibility:always
Severity:   minor
Priority:   normal
Status: new
== 
Date Submitted: 2016-04-07 16:58 EDT
Last Modified:  2016-04-07 16:58 EDT
== 
Summary:"nmake" program is not found using MAKE environment
variable
Description: 
If you set MAKE=C:\path\to\nmake.exe in your environment, but nmake is not in
your PATH, then the NMake generator will fail.

Looking for nmake in the current PATH is reasonable, but if MAKE is defined,
then that should be used instead.
== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2016-04-07 16:58 Daniel Richard G.New Issue
==

-- 

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] [CMake 0016054]: Cannot override CMAKE_{C, CXX}_FLAGS* to allow compiler check to succeed

2016-04-07 Thread Mantis Bug Tracker

The following issue has been SUBMITTED. 
== 
https://public.kitware.com/Bug/view.php?id=16054 
== 
Reported By:Daniel Richard G.
Assigned To:
== 
Project:CMake
Issue ID:   16054
Category:   CMake
Reproducibility:always
Severity:   major
Priority:   normal
Status: new
== 
Date Submitted: 2016-04-07 16:53 EDT
Last Modified:  2016-04-07 16:53 EDT
== 
Summary:Cannot override CMAKE_{C,CXX}_FLAGS* to allow
compiler check to succeed
Description: 
I am attempting to build a project on a Windows system.

The development tools on this system are set up a little differently from the
norm: Because my company always builds against the static C runtime library
(i.e. using the /MT flag), the dynamic C runtime (/MD) stub library is not
present at all. Any attempt to link an executable/DLL that was built with /MD
will fail.

Now, CMake ships with /MD or /MDd in the default flags. I set my desired flags
(including /MT) in CFLAGS/CXXFLAGS in the environment, start up cmake-gui, and
hit "Configure".

"Error in configuration process, project files may be invalid"

The log window shows

CMake Error at C:/.../Modules/CMakeTestCCompiler.cmake:61 (message):
  The C compiler "C:/.../icl.exe" is
  not able to compile a simple test program.

Lower down, after the compiler invocation, I see

icl: command line warning https://public.kitware.com/Bug/view.php?id=10121:
overriding '/MT' with '/MDd'

CMake's flags are concatenated to my own, and /MDd wins out. Thus the linker
fails to link the program, due to that missing stub library, and CMake reports
the compiler as non-functional.

Okay, so I edit the CMAKE_{C,CXX}_FLAGS* variables to remove all the /MD and
/MDd flags. Then I configure again. Same error. It's _still_ passing /MDd to the
compiler!

At this point, I don't know where that flag is coming from. I grep through the
nascent build tree to see if there are any instances of it still kicking around;
the only hit is in CMakeError.log. I double-check that the project source isn't
at fault: nope, the flag is nowhere to be found there either.

Turns out, the place where that flag is coming from is CMake's own
Modules/Platform/Windows-MSVC.cmake file. If I edit the _INIT variable in there
(e.g. add /Dhi_mom), then I see the result reflected in the compiler test.

The bug, then, is that I have no good way of overriding those flag variables in
order to allow the compiler check to succeed. (Note that
CMAKE_USER_MAKE_RULES_OVERRIDE is not applicable here, because I want to
override those flags as a user, not modify the project to get the same effect.)

Perhaps the edited variables are used later on, when building the project, but
they are certainly not used when checking the compiler. I believe this bug has
gone unnoticed for so long due to this specific scenario (missing dynamic CRT
stub library) being uncommon.

Note that this issue is reproducible with a trivial CMake project---I used one
as described at cmake.org/examples---so the original project that exhibited this
bug is not at issue.

Additional Information: 
Because I need to use my company's exact compiler/linker flags, and will be
given grief by my release-engineering group if I use anything else, it would be
nice to be able to set some environment variable or the like that will tell
CMake not to "help" with any default flags.

While I can always edit the Windows-MSVC.cmake file, that then imposes the
ongoing burden of maintaining that file, merging in upstream changes, etc. My
goal is to just set CFLAGS/LDFLAGS/etc. in the environment and have the tools
work with that, as is the case in Unix. (Setting a CMAKE_NO_DEFAULT_FLAGS
variable or the like would be a reasonable solution.)
== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2016-04-07 16:53 Daniel Richard G.New Issue
==

-- 

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 

[cmake-developers] [CMake 0016053]: $ should return a short path on Windows when containing spaces

2016-04-07 Thread Mantis Bug Tracker

The following issue has been SUBMITTED. 
== 
https://cmake.org/Bug/view.php?id=16053 
== 
Reported By:Guillaume Dumont
Assigned To:
== 
Project:CMake
Issue ID:   16053
Category:   CMake
Reproducibility:always
Severity:   minor
Priority:   normal
Status: new
== 
Date Submitted: 2016-04-07 11:26 EDT
Last Modified:  2016-04-07 11:26 EDT
== 
Summary:$ should return a short path on
Windows when containing spaces
Description: 
I am trying to build OpenCV from sources using MSVC and the Ninja Generator and
I have a failing build because of linker flags added to the
target_link_libraries. OpenCV's CMakeLists.txt uses this line of CMake code:

set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} -L${p})

OPENCV_LINKER_LIBS is passed to target_link_libraries afterwards. The problem
with this line is that it does not work on Windows with the Ninja generator. I
tried:

set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS}
${CMAKE_LIBRARY_PATH_FLAG}$)

but that does not work either because the even though we end up using /LIBPATH:
instead of /L and backslashes instead of forward slashes the path contains
spaces and ninja throws a link error. 

Shouldn't SHELL_PATH return a short path, or a path between quotes when the path
contains spaces on Windows?


Steps to Reproduce: 
Try to build OpenCV 3.1.0 on Windows with Ninja.

Additional Information: 
See OpenCV issue: https://github.com/Itseez/opencv/issues/6372
== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2016-04-07 11:26 Guillaume DumontNew Issue
==

-- 

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] [CMake 0016052]: Extra space on NDEBUG in release builds causes flag to be ignored

2016-04-07 Thread Mantis Bug Tracker

The following issue has been SUBMITTED. 
== 
http://kwwidgets.org/Bug/view.php?id=16052 
== 
Reported By:Stephen Dunn
Assigned To:
== 
Project:CMake
Issue ID:   16052
Category:   CMake
Reproducibility:always
Severity:   major
Priority:   normal
Status: new
== 
Date Submitted: 2016-04-07 10:36 EDT
Last Modified:  2016-04-07 10:36 EDT
== 
Summary:Extra space on NDEBUG in release builds causes flag
to be ignored
Description: 
This bug was previously reported, but incorrectly marked as resolved here:
http://kwwidgets.org/Bug/view.php?id=1749

All Release mode configs accidentally append a space after /D in Visual Studio
2015 (14) which causes the flag NDEBUG to be ignored. It should be: /DNDEBUG,
not /D NDEBUG which is invalid syntax. Other /D flags are defined correctly.

I check for the presence of this var, and its absence in Release mode causes
undefined behavior.

Steps to Reproduce: 
Generate any project with Release mode builds.
== 

Issue History 
Date ModifiedUsername   FieldChange   
== 
2016-04-07 10:36 Stephen Dunn   New Issue
2016-04-07 10:36 Stephen Dunn   File Added: cmake-bug.png
==

-- 

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] -isystem suppresses warnings from user header

2016-04-07 Thread Brad King
On 04/07/2016 10:03 AM, Tamás Kenéz wrote:
> CMake uses "-isystem" on the compiler command line for the
> INTERFACE_INCLUDE_DIRECTORIES of imported libraries.
> 
> Question: is this the intended behaviour?

Yes.  See discussion here:

* http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/7533

and implementation here:

* Always consider includes from IMPORTED targets to be SYSTEM.
  https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a63fcbcb

> Can I force the -I flag somehow for my library?

Look at these:

* https://cmake.org/cmake/help/v3.5/variable/CMAKE_NO_SYSTEM_FROM_IMPORTED.html
* https://cmake.org/cmake/help/v3.5/prop_tgt/NO_SYSTEM_FROM_IMPORTED.html

-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] -isystem suppresses warnings from user header

2016-04-07 Thread Tamás Kenéz
Environment: CMake 3.5, linux, g++

CMake uses "-isystem" on the compiler command line for the
INTERFACE_INCLUDE_DIRECTORIES of imported libraries.

Unfortunately including a header via an isystem path suppresses warnings
emitted from the header, such as warnings caused by expansions of macros
defined in that header.

Example: I have a printf-like LOG(...) macro which expands to a function
marked as printf-like. The -Wformat warnings are suppressed if the
containing log.h is found on isystem path.

Question: is this the intended behaviour? Can I force the -I flag somehow
for my library? (I'm aware of CMAKE_INCLUDE_SYSTEM_FLAG_CXX but I don't
want to modify all the client projects that uses my library.)

Or is it bug?

Thanks,
Tamas
-- 

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