<div dir="ltr">The CMake module scripting is weak regarding the variable that should be taking care of this, <div>CMAKE_SYSTEM_PREFIX_PATH  (i.e., /usr; /opt)  will be used in find_path (after appending /include)</div><div>
and for find_library(after appending /lib) - according to cmake.html documentation. For my mingw/msys</div><div>builds I set this and the /include, /lib mostly located in platform/MingW.cmake:</div><div><div>----------------</div>
<div>if(MSYS)</div><div># enhance the system prefix path.  (picks up /Mingw/lib)</div><div><span class="" style="white-space:pre">             </span>find_path( MINGWPATH msys </div><div><span class="" style="white-space:pre">                </span>   PATH ${CMAKE_USR_PATH}/../../</div>
<div><span class="" style="white-space:pre">            </span>NO_DEFAULT_PATH)</div><div><span class="" style="white-space:pre">           </span></div><div><span class="" style="white-space:pre">           </span>list(APPEND<span class="" style="white-space:pre">       </span>CMAKE_SYSTEM_PREFIX_PATH ${MINGWPATH} )<br>
</div><div><span class="" style="white-space:pre">                </span>list(APPEND CMAKE_SYSTEM_INCLUDE_PATH ${MINGWPATH}/include )</div><div><span class="" style="white-space:pre">               </span>list(APPEND CMAKE_SYSTEM_LIBRARY_PATH ${MINGWPATH}/lib )</div>
</div><div>-------</div><div>then LDFLAGS is inspected:</div><div>____</div><div><span class="" style="white-space:pre">      </span>set(LDFLAGS "$ENV{LDFLAGS}")<br></div><div><div><span class="" style="white-space:pre">        </span>if(LDFLAGS)</div>
<div><span class="" style="white-space:pre">            </span>message(STATUS "\n"</div><div><span class="" style="white-space:pre">                      </span>" <Platform/Mingw> inspecting LDFLAGS: ${LDFLAGS}"<span class="" style="white-space:pre">                </span>)</div>
<div><span class="" style="white-space:pre">            </span>string( REGEX MATCHALL "-L([^\" ]+)" librarylist</div><div>        "${LDFLAGS}"<span class="" style="white-space:pre">          </span>)</div><div><span class="" style="white-space:pre">  </span>foreach(element  IN LISTS librarylist)<span class="" style="white-space:pre">           </span># LDFLAGS is more specific.</div>
</div><div>------------ etc., leading to</div><div><div><span class="" style="white-space:pre">                         </span>message(STATUS</div><div><span class="" style="white-space:pre">                     </span>"<Platform/Mingw>  adding system library path: ${library}")</div>
<div><span class="" style="white-space:pre">                            </span>list(INSERT CMAKE_SYSTEM_LIBRARY_PATH 0 ${library})</div><div><span class="" style="white-space:pre">                                </span>list(INSERT CMAKE_SYSTEM_INCLUDE_PATH 0 ${library}/../include )</div>
</div><div>-------------------------------------------------------</div><div><div><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jul 9, 2014 at 4:14 AM, Mantis Bug Tracker <span dir="ltr"><<a href="mailto:mantis@public.kitware.com" target="_blank">mantis@public.kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
The following issue has been SUBMITTED.<br>
======================================================================<br>
<a href="http://public.kitware.com/Bug/view.php?id=15011" target="_blank">http://public.kitware.com/Bug/view.php?id=15011</a><br>
======================================================================<br>
Reported By:                hsk<br>
Assigned To:<br>
======================================================================<br>
Project:                    CMake<br>
Issue ID:                   15011<br>
Category:                   (No Category)<br>
Reproducibility:            always<br>
Severity:                   minor<br>
Priority:                   normal<br>
Status:                     new<br>
======================================================================<br>
Date Submitted:             2014-07-09 07:14 EDT<br>
Last Modified:              2014-07-09 07:14 EDT<br>
======================================================================<br>
Summary:                    problem to find non-standard ncurses.h location<br>
Description:<br>
i have installed gnu ncurses (and several other libraries) under separate<br>
location; os: solaris10, compiler: sunstudio 12.2<br>
<br>
building cmake 2.8.x worked using<br>
<br>
env \<br>
  CC=cc \<br>
  CFLAGS='-xtarget=ultra2 -xarch=sparcvis -xO4' \<br>
  CXX=CC \<br>
  CXXFLAGS='-xtarget=ultra2 -xarch=sparcvis -xO4' \<br>
  LDFLAGS='-L/var/imb/lib -R/var/imb/lib -L/usr/sfw/lib -R/usr/sfw/lib -s' \<br>
  CPPFLAGS=-I/var/imb/include \<br>
    ./bootstrap --prefix=/var/imb;  gmake<br>
<br>
with cmake 3.0, the "gmake" step fails:<br>
<br>
cmake-3.0.0/Source/CursesDialog/form/form.h", line 46: cannot find include file:<br>
<ncurses/ncurses.h><br>
<br>
and -I/var/imb/include must be explicitly added to CFLAGS / CXXFLAGS for<br>
ncurses.h to be found, i.e., i have to use<br>
<br>
env \<br>
  CC=cc \<br>
  CFLAGS='-xtarget=ultra2 -xarch=sparcvis -xO4 -I/var/imb/include' \<br>
  CXX=CC \<br>
  CXXFLAGS='-xtarget=ultra2 -xarch=sparcvis -xO4 -I/var/imb/include' \<br>
  LDFLAGS='-L/var/imb/lib -R/var/imb/lib -L/usr/sfw/lib -R/usr/sfw/lib -s' \<br>
  CPPFLAGS=-I/var/imb/include \<br>
    ./bootstrap --prefix=/var/imb;  gmake<br>
<br>
imho, the value of CPPFLAGS should be honoured here<br>
<br>
======================================================================<br>
<br>
Issue History<br>
Date Modified    Username       Field                    Change<br>
======================================================================<br>
2014-07-09 07:14 hsk            New Issue<br>
======================================================================<br>
<br>
--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake-developers" target="_blank">http://public.kitware.com/mailman/listinfo/cmake-developers</a><br>
</blockquote></div><br></div>