[CMake] find_program usage

2019-06-04 Thread vinay kumar Kotegowder
Hi Everyone,

This is simple code running on Windows machine:

if(WIN32)
  message(STATUS "On windows")
  find_program(_TOOL
  arm-none-eabi-gcc.exe
  PATHS "C:"
)
endif()

message(STATUS "${_TOOL}")

Result after executing: cmake -P mycmake.cmake

-- On windows
-- _TOOL-NOTFOUND

Can anyone tell me what is wrong with the usage of "find_program"  ?

Vinay
Senior Engineer
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] find_program usage

2019-06-04 Thread Kyle Edwards via CMake
On Tue, 2019-06-04 at 19:07 +0530, vinay kumar Kotegowder wrote:
> Hi Everyone,
> 
> This is simple code running on Windows machine:
> 
> if(WIN32)
>   message(STATUS "On windows")
>   find_program(_TOOL
>   arm-none-eabi-gcc.exe
>   PATHS "C:"
> )
> endif()
> 
> message(STATUS "${_TOOL}")
> 
> Result after executing: cmake -P mycmake.cmake
> 
> -- On windows
> -- _TOOL-NOTFOUND
> 
> Can anyone tell me what is wrong with the usage of "find_program"  ?

find_program() is looking in C:, but not its subdirectories. So, unless
arm-none-eabi-gcc.exe is located directly in C:, CMake won't find it.

As a side note, GCC isn't typically found with find_program(). You most
likely want to write a cross-compiling toolchain file which contains
this location instead. See below for details:

https://cmake.org/cmake/help/v3.14/manual/cmake-toolchains.7.html

Kyle
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] find_program usage

2019-06-04 Thread vinay kumar Kotegowder
The original intent of the snippet is to find the required tool chain
(On windows : arm-none-eabi-gcc.exe or armclang.exe; On Linix :
arm-none-eabi-gcc or armclang) path which can later be used to build
the project.

I have been trying with find_program and find_path commands.
My understanding was that it would find the program from root(which is
C: in Windows and / in Linux) and all the sub directories underneath
it but I learnt from your reply that it is not the case.

Can this be done? I mean, should it be possible to find the program
without hard coding the path ?

- Vinay

On Tue, Jun 4, 2019 at 7:12 PM Kyle Edwards  wrote:
>
> On Tue, 2019-06-04 at 19:07 +0530, vinay kumar Kotegowder wrote:
> > Hi Everyone,
> >
> > This is simple code running on Windows machine:
> >
> > if(WIN32)
> >   message(STATUS "On windows")
> >   find_program(_TOOL
> >   arm-none-eabi-gcc.exe
> >   PATHS "C:"
> > )
> > endif()
> >
> > message(STATUS "${_TOOL}")
> >
> > Result after executing: cmake -P mycmake.cmake
> >
> > -- On windows
> > -- _TOOL-NOTFOUND
> >
> > Can anyone tell me what is wrong with the usage of "find_program"  ?
>
> find_program() is looking in C:, but not its subdirectories. So, unless
> arm-none-eabi-gcc.exe is located directly in C:, CMake won't find it.
>
> As a side note, GCC isn't typically found with find_program(). You most
> likely want to write a cross-compiling toolchain file which contains
> this location instead. See below for details:
>
> https://cmake.org/cmake/help/v3.14/manual/cmake-toolchains.7.html
>
> Kyle
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] find_program usage

2019-06-04 Thread Kyle Edwards via CMake
On Tue, 2019-06-04 at 19:38 +0530, vinay kumar Kotegowder wrote:
> The original intent of the snippet is to find the required tool chain
> (On windows : arm-none-eabi-gcc.exe or armclang.exe; On Linix :
> arm-none-eabi-gcc or armclang) path which can later be used to build
> the project.
> 
> I have been trying with find_program and find_path commands.
> My understanding was that it would find the program from root(which
> is
> C: in Windows and / in Linux) and all the sub directories underneath
> it but I learnt from your reply that it is not the case.
> 
> Can this be done? I mean, should it be possible to find the program
> without hard coding the path ?

It is possible to pass hints and paths to find_program() telling it
additional places to look ("it *might* be in C:/MinGW/whatever/bin"),
but other than that, find_program() does not search recursively. See
the find_program() documentation for more details:

https://cmake.org/cmake/help/v3.14/command/find_program.html

Again, for GCC, I strongly recommend that you use a toolchain file,
rather than setting CMAKE_C_COMPILER from inside your project. CMake
does a bunch of checks with the compiler when you first call project(),
which end up no longer being valid if you change CMAKE_C_COMPILER. (I
suppose you could set CMAKE_C_COMPILER from in your project before
calling project(), but I do not recommend this method.) You *can* call
find_program() from inside your toolchain file if you don't want to
hard-code the paths.

Kyle
-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] Question about regular expressions

2019-06-04 Thread Steven Truppe

Hi everyone,


i had the same question a few days ago but can't rember the command (and
can't find it in the cods):

I have a regular expression like "WITH_LIB${lib}_EXAMPLE_([A-Za-z]+)"
and i want the get the content of the found variables in the (), the
command i used stored them if MATCH_XYZ but i can't exactly rember =(.


best regards!

--

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Question about regular expressions

2019-06-04 Thread Kyle Edwards via CMake
On Tue, 2019-06-04 at 16:39 +0200, Steven Truppe wrote:
> Hi everyone,
> 
> 
> i had the same question a few days ago but can't rember the command
> (and
> can't find it in the cods):
> 
> I have a regular expression like "WITH_LIB${lib}_EXAMPLE_([A-Za-z]+)"
> and i want the get the content of the found variables in the (), the
> command i used stored them if MATCH_XYZ but i can't exactly rember
> =(.
> 
> 
> best regards!

CMAKE_MATCH_

https://cmake.org/cmake/help/v3.14/variable/CMAKE_MATCH_n.html

Kyle
-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] General question:

2019-06-04 Thread Steven Truppe

Hi everyone again,


i've the following code:

https://paste.debian.net/1086040/

and i just try to traverse a list and include files whose part of the
name are the list entries.


best regards!

--

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] General question:

2019-06-04 Thread Steven Truppe

I want the output not to be 'in' but 'glade' ...


On 04.06.19 17:10, Steven Truppe wrote:

Hi everyone again,


i've the following code:

https://paste.debian.net/1086040/

and i just try to traverse a list and include files whose part of the
name are the list entries.


best regards!


--

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] General question:

2019-06-04 Thread Kyle Edwards via CMake
On Tue, 2019-06-04 at 17:11 +0200, Steven Truppe wrote:
> I want the output not to be 'in' but 'glade' ...
> 
> 
> On 04.06.19 17:10, Steven Truppe wrote:
> > 
> > Hi everyone again,
> > 
> > 
> > i've the following code:
> > 
> > https://paste.debian.net/1086040/
> > 
> > and i just try to traverse a list and include files whose part of
> > the
> > name are the list entries.
> > 
> > 
> > best regards!
> > 

Please see the foreach() documentation:

https://cmake.org/cmake/help/v3.14/command/foreach.html

I think you want:

foreach(lib IN LISTS libs)

Kyle
-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] General question

2019-06-04 Thread Steven Truppe

    Hi everyone,


i have the following code:

set(ALL_LIBS "glad;glfw")

# WITH_LIB_GLAD
option(WITH_LIB_GLAD 1)
option(WITH_LIB_GLAD_EXAMPLE_BASIC "Build the basic Glad example (default:0)" 1)
option(WITH_LIB_GLAD_EXAMPLE_SECOND "Build the second Glad example (default:0)" 
1)

# WITH_LIB_GLFW
option(WITH_LIB_GLFW 1)
option(WITH_LIB_GLFW_EXAMPLE_CBASIC "Build the basic GLFW C example 
(default:1)" 1)
option(WITH_LIB_GLFW_EXAMPLE_CPPBASIC "Build the basic GLFW C example 
(default:1)" 1)



## bsBuildLib ##

macro(bsBuildLibs libs)
    foreach(lib ${libs})
        message(STATUS "Searching incude path for lib: <${lib}>")
        bsIncludeLibs(${lib})
        bsBuildLibExamples(${lib})
    endforeach()
endmacro()

###
## bsIncludeLibs ##
###
macro(bsIncludeLibs lib)
    message(STATUS "INCLUDE library ${lib}")
    include("lib_${lib}")
endmacro()


## bsBuildLibExamples ##

macro(bsBuildLibExamples lib)
    # get all examples
    foreach(_var in VARIABLES)
        string(TOUPPER ${lib} lib_upper)
        if(_var MATCHES "WITH_LIB_${lib_upper}_EXAMPLE_([A-Za-z]+)")
            message(STATUS "Found example: ${CMAKE_MATCH_0}")
        endif()
    endforeach()
endmacro()

The final result should be that i get the name of the examples, like for
glad BASIC and SECOND and for glfw CBASIC and CPPBASIC.


best regards!




-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] General question about regex

2019-06-04 Thread Steven Truppe

Hello again,


i've the following variable defined:

set(WITH_LIB_GLAD_EXAMPLE_BASIC 1)

And the if the line


foreach(_var VARIABLES)

    if(_var MATCHES "WITH_LIB_GLAD_EXAMPLE_([A-Za-z]+)")

        message(STATUS "Found a match")

endforeach()


I never get the message "Found match", what am i doing wrong here ??

--

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] General question about regex

2019-06-04 Thread Kornel Benko
Am Dienstag, 4. Juni 2019, 18:10:19 CEST schrieb Steven Truppe:
> Hello again,
> 
> 
> i've the following variable defined:
> 
> set(WITH_LIB_GLAD_EXAMPLE_BASIC 1)
> 
> And the if the line
> 
> 
> foreach(_var VARIABLES)
> 
>  if(_var MATCHES "WITH_LIB_GLAD_EXAMPLE_([A-Za-z]+)")
> 
>  message(STATUS "Found a match")
> 
> endforeach()
> 
> 
> I never get the message "Found match", what am i doing wrong here ??
> 
> 

What about the attached?

Kornel
set(WITH_LIB_GLAD_EXAMPLE_BASIC 1)

get_cmake_property(_variableNames VARIABLES)
foreach(_var ${_variableNames})

 message(STATUS "_var = ${_var}")
 if(_var MATCHES "WITH_LIB_GLAD_EXAMPLE_([A-Za-z]+)")

 message(STATUS "Found a match")
endif()

endforeach()



signature.asc
Description: This is a digitally signed message part.
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] General question about regex

2019-06-04 Thread Steven Truppe

I found the solution:

    get_cmake_property(_vars VARIABLES)
    foreach(_var ${_vars})
        string(TOUPPER ${lib} lib_upper)
        if(_var MATCHES "^WITH_LIB_${lib_upper}_EXAMPLE_([A-Za-z]+)$")
        message(STATUS "Number of examples found: ${CMAKE_MATCH_COUNT}")
        message(STATUS "Number 1 found: ${CMAKE_MATCH_0}")
        endif()

    endforeach()

Now i've two problem - the CMAKE_MATCH_0 contains the hole string and
not only the part the is in the (), i need only the part from the () -
is there another command i can use for this ?


On 04.06.19 18:47, Kornel Benko wrote:

Am Dienstag, 4. Juni 2019, 18:10:19 CEST schrieb Steven Truppe:

Hello again,


i've the following variable defined:

set(WITH_LIB_GLAD_EXAMPLE_BASIC 1)

And the if the line


foreach(_var VARIABLES)

  if(_var MATCHES "WITH_LIB_GLAD_EXAMPLE_([A-Za-z]+)")

  message(STATUS "Found a match")

endforeach()


I never get the message "Found match", what am i doing wrong here ??



What about the attached?

Kornel

-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] General question about regex

2019-06-04 Thread Kyle Edwards via CMake
On Tue, 2019-06-04 at 19:19 +0200, Steven Truppe wrote:
> I found the solution:
>     get_cmake_property(_vars VARIABLES)
>     foreach(_var ${_vars})
>         string(TOUPPER ${lib} lib_upper)
>         if(_var MATCHES "^WITH_LIB_${lib_upper}_EXAMPLE_([A-Za-
> z]+)$")
>           message(STATUS "Number of examples found:
> ${CMAKE_MATCH_COUNT}")
>       message(STATUS "Number 1 found: ${CMAKE_MATCH_0}")
>         endif()
>     endforeach()
> Now i've two problem - the CMAKE_MATCH_0 contains the hole string and
> not only the part the is in the (), i need only the part from the ()
> - is there another command i can use for this ?

CMAKE_MATCH_1

Kyle
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] General question about regex

2019-06-04 Thread Steven Truppe

Thanks alot. My other problem i have no how can i loop over the result,
there are just variables and ${CMAKE_CATCH_COUNT) what command can i use
the iterate over the result ??


best regrads!

On 04.06.19 19:22, Kyle Edwards wrote:

On Tue, 2019-06-04 at 19:19 +0200, Steven Truppe wrote:

I found the solution:
     get_cmake_property(_vars VARIABLES)
     foreach(_var ${_vars})
         string(TOUPPER ${lib} lib_upper)
         if(_var MATCHES "^WITH_LIB_${lib_upper}_EXAMPLE_([A-Za-
z]+)$")
        message(STATUS "Number of examples found:
${CMAKE_MATCH_COUNT}")
        message(STATUS "Number 1 found: ${CMAKE_MATCH_0}")
         endif()
     endforeach()
Now i've two problem - the CMAKE_MATCH_0 contains the hole string and
not only the part the is in the (), i need only the part from the ()
- is there another command i can use for this ?

CMAKE_MATCH_1

Kyle


--

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Linking on OSX

2019-06-04 Thread Bryan Christ
Juan,

Thanks for your suggestions.  I went through that thread pretty thoroughly
trying all of the recommended tips and, unfortunately, nothing seemed to
work.  I also tried running that open command you cited, but there are
still no includes for ncurses in /usr/include or /usr/local/include.  In
fact /usr/include doesn't even exist on this system (mojave).

On Mon, Jun 3, 2019 at 5:27 PM Juan E. Sanchez 
wrote:

> Hello,
>
> According to this:
> https://github.com/neovim/neovim/issues/9050
>
> It looks like macOS made it so you have to do something like this:
> open
>
> /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
>
> for libraries and includes to be put into /usr.
>
> Regards,
>
> Juan
>
>
> On 6/3/19 5:16 PM, Bryan Christ wrote:
> > New to this mailing list so I hope I'm asking this in the right venue...
> >
> > I'm trying to port my application (a program and a shared library) to
> > OSX.  It was rather easy to modify my CMake script to go from Linux and
> > add in FreeBSD.  OSX is giving me a lot of problems though.
> >
> > First of all find_package() doesn't seem to find the ncurses.dylib
> > installed by XCode as it test for wsyncup().  For whatever reason, that
> > test fails.  The default location for the library is pretty sane
> > (/usr/lib/) but the include file for ncurses is about 9 directories deep
> > inside of XCode's install directory.  Lots of problems here so I decided
> > to look at the symbol linkage for htop and see what it does.  It links
> > to a different version that got pulled down via homebrew in
> > /usr/local/opt/ncurses/lib (and include respectively)
> >
> > Is there a way to force CMake to link to the library found there instead
> > of in /usr/lib/ ?
> >
> > --
> > Bryan
> > <><
> >
>
> --
>
> 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:
> https://cmake.org/mailman/listinfo/cmake
>


-- 
Bryan
<><
-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] In add_subdirectory( binary_dir), binary_dir/ is just a decoy when there's no sub-target

2019-06-04 Thread Marc Herbert
tl;dr: should there be at least one target per CMakeLists.txt?

https://cmake.org/cmake/help/v3.14/command/add_subdirectory.html
> add_subdirectory(source_dir [binary_dir] )
> "The binary_dir specifies the directory in which to place the output
files. [...] If binary_dir is not specified, the value of source_dir,
before expanding any relative path, will be used (the typical usage)."

I found this part of the documentation to be correct ONLY when the
subdirectory defines and uses its own "sub-"target(s). If the subdirectory
refers to higher main targets instead then binary_dir/ is just a decoy: the
subdirectory build happens elsewhere. binary_dir is a decoy whether it's
explicit or default. It exists but there are only totally generic and
unused files there.

Example:

mainsrc/
├── CMakeLists.txt
├── inmodule
│   ├── CMakeLists.txt
│   ├── infile.c
└── mainfile.c


# mainsrc/CMakeLists.txt
add_executable(mainexe mainfile.c)
add_subdirectory(inmodule [ decoy_binary_dir ] )

# mainsrc/inmodule/CMakeLists.txt
target_sources(mainexe PRIVATE infile.c) # <= direct reference, no
sub-target


cmake -GNinja -B build -S mainsrc && ninja -C build

build
├── CMakeFiles
│   ├──
│   ├── mainexe.dir
│   │   ├──
│   │   ├──
│   │   ├── inmodule   <= ACTUAL binary_dir!
│   │   │   └── infile.c.o
│   │   ├── mainfile.c.o
│   │   ├──
│   │   :
│   ├──
│   :
├── inmodule   <= decoy with unused, boilerplate files and no reference
to any code
│   ├── CMakeFiles/
│   ├── cmake_install.cmake


The midly irritating part is that cmake complains about the lack of a
binary_dir argument if the module is an _out-of-tree_ subdirectory:

CMake Error at CMakeLists.txt:5 (add_subdirectory):
  add_subdirectory not given a binary directory but the given source
  directory "~/cmake-test/outmodule" is not a subdirectory of
  "~/cmake-test/maindir".  When specifying an out-of-tree source
  a binary directory must be explicitly specified.

That request makes sense of course except... when given that binary_dir
argument it requested, it's still becomes a decoy as described above.
This is the actual (and funny) binary_dir /in this out-of-tree case:
build
├── CMakeFiles
│   ├── mainexe.dir
│   │   └── home
│   │   └── joe
│   │   └── cmake-test
│   │   └── outmodule
│   │   └── outfile.c.o



Reproduced with cmake version 3.14.4. No difference between make and ninja.

Researching the interwebs most people, tutorials and other documents seem
to assume (at least) one target per CMakeLists.txt. Should such a
recommendation be made more official to avoid the sort of confusion above?
Could this recommendation avoid other, unrelated problems I haven't
experienced? Yet?

Marc
-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] [ANNOUNCE] CMake 3.15.0-rc1 is ready for testing

2019-06-04 Thread Robert Maynard via CMake
I am proud to announce the first CMake 3.15 release candidate.
  https://cmake.org/download/

Documentation is available at:
  https://cmake.org/cmake/help/v3.15

Release notes appear below and are also published at
  https://cmake.org/cmake/help/v3.15/release/3.15.html

Some of the more significant changes in CMake 3.15 are:

* The "CMAKE_MSVC_RUNTIME_LIBRARY" variable and
  "MSVC_RUNTIME_LIBRARY" target property were introduced to select the
  runtime library used by compilers targeting the MSVC ABI. See policy
  "CMP0091".

* With MSVC-like compilers the value of "CMAKE__FLAGS" no
  longer contains warning flags like "/W3" by default. See policy
  "CMP0092".

* The "Clang" compiler variant on Windows that targets the MSVC ABI
  but has a GNU-like command line is now supported.

* Preliminary support for the "Swift" language was added to the
  "Ninja" generator.

* The "$" generator expression was
  introduced to allow specification of compile options for target
  files based on the "CMAKE__COMPILER_ID" and "LANGUAGE" of each
  source file.

* The "generator expressions" "C_COMPILER_ID", "CXX_COMPILER_ID",
  "CUDA_COMPILER_ID", "Fortran_COMPILER_ID", "COMPILE_LANGUAGE",
  "COMPILE_LANG_AND_ID", and "PLATFORM_ID" learned to support matching
  one value from a comma-separated list.

* The "CMAKE_FIND_PACKAGE_PREFER_CONFIG" variable was added to tell
  "find_package()" calls to look for a package configuration file
  first even if a find module is available.

* The "PUBLIC_HEADER" and "PRIVATE_HEADER" properties may now be set
  on Interface Libraries. The headers specified by those properties
  can be installed using the "install(TARGETS)" command by passing the
  "PUBLIC_HEADER" and "PRIVATE_HEADER" arguments respectively.

* The "CMAKE_VS_JUST_MY_CODE_DEBUGGING" variable and
  "VS_JUST_MY_CODE_DEBUGGING" target property were added to enable the
  Just My Code feature of the Visual Studio Debugger when compiling
  with MSVC cl 19.05 and higher.

* The "FindBoost" module was reworked to expose a more consistent
  user experience between its “Config” and “Module” modes and with
  other find modules in general.

* The "message()" command learned new types: "NOTICE", "VERBOSE",
  "DEBUG" and "TRACE".

* The "export(PACKAGE)" command now does nothing unless enabled via
  "CMAKE_EXPORT_PACKAGE_REGISTRY". See policy "CMP0090".


* The "CMAKE_GENERATOR" environment variable was added to specify a
  default generator to use when "cmake(1)" is run without a "-G"
  option.  Additionally, environment variables
  "CMAKE_GENERATOR_PLATFORM", "CMAKE_GENERATOR_TOOLSET", and
  "CMAKE_GENERATOR_INSTANCE" were created to configure the generator.

* The "cmake(1)" command gained a new "--install" option. This may
  be used after building a project to run installation without using
  the generated build system or the native build tool.

* The "cmake(1)" command learned a new CLI option "--loglevel".

* The "cmake-server(7)" mode has been deprecated and will be removed
  from a future version of CMake.  Please port clients to use the
  "cmake-file-api(7)" instead.


CMake 3.15 Release Notes


Changes made since CMake 3.14 include the following.


New Features



Generators
--

* The "Xcode" generator now supports per-target schemes. See the
  "CMAKE_XCODE_GENERATE_SCHEME" variable and "XCODE_GENERATE_SCHEME"
  target property.

* The "Green Hills MULTI" generator has been updated:

  * It now supports the "add_custom_command()" and
"add_custom_target()" commands.

  * It is now available on Linux.


Languages
-

* Preliminary support for the "Swift" language was added to the
  "Ninja" generator:

  * Use the "SWIFTC" environment variable to specify a compiler.

  * The "Swift_DEPENDENCIES_FILE" target property and
"Swift_DEPENDENCIES_FILE" source file property were added to
customize dependency files.

  * The "Swift_MODULE_NAME" target property was added to customize
the Swift module name.

  * The "Swift_DIAGNOSTICS_FILE" source property was added to
indicate where to write the serialised Swift diagnostics.

  The Swift support is experimental, not considered stable, and may
  change in future releases of CMake.


Compilers
-

* The "Clang" compiler variant on Windows that targets the MSVC ABI
  but has a GNU-like command line is now supported.

* Support for the Clang-based ARM compiler was added with compiler
  id "ARMClang".

* Support was added for the IAR compiler architectures Renesas RX,
  RL78, RH850 and Texas Instruments MSP430.

* Support was added for the IAR compilers built for Linux (IAR
  BuildLx).


Command-Line


* The "CMAKE_GENERATOR" environment variable was added to specify a
  default generator to use when "cmake(1)" is run without a "-G"
  option.  Additionally, environment variables
  "CMAKE_GENERATOR_PLATFORM", "CMAKE_GENERATOR_TOOLSET", and
  "CMAKE_GENERATOR_INSTANCE" were created to configure the generator.

Re: [CMake] Linking on OSX

2019-06-04 Thread Bryan Christ
Juan,

In my case I was looking to build and link against ncurses.  A second set
of libs got installed by homebrew so I decided to use those instead.  To
use the alternate location, I was told the following would work (and it
did).

set(CMAKE_PREFIX_PATH /usr/local/opt/ncurses)



On Mon, Jun 3, 2019 at 5:27 PM Juan E. Sanchez 
wrote:

> Hello,
>
> According to this:
> https://github.com/neovim/neovim/issues/9050
>
> It looks like macOS made it so you have to do something like this:
> open
>
> /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
>
> for libraries and includes to be put into /usr.
>
> Regards,
>
> Juan
>
>
> On 6/3/19 5:16 PM, Bryan Christ wrote:
> > New to this mailing list so I hope I'm asking this in the right venue...
> >
> > I'm trying to port my application (a program and a shared library) to
> > OSX.  It was rather easy to modify my CMake script to go from Linux and
> > add in FreeBSD.  OSX is giving me a lot of problems though.
> >
> > First of all find_package() doesn't seem to find the ncurses.dylib
> > installed by XCode as it test for wsyncup().  For whatever reason, that
> > test fails.  The default location for the library is pretty sane
> > (/usr/lib/) but the include file for ncurses is about 9 directories deep
> > inside of XCode's install directory.  Lots of problems here so I decided
> > to look at the symbol linkage for htop and see what it does.  It links
> > to a different version that got pulled down via homebrew in
> > /usr/local/opt/ncurses/lib (and include respectively)
> >
> > Is there a way to force CMake to link to the library found there instead
> > of in /usr/lib/ ?
> >
> > --
> > Bryan
> > <><
> >
>
> --
>
> 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:
> https://cmake.org/mailman/listinfo/cmake
>


-- 
Bryan
<><
-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] General question about variable scope.

2019-06-04 Thread Steven Truppe

Hi everyone,


i've the following code:

macro(bsBuildLibExamples lib)
# get all examples
get_cmake_property(_vars VARIABLES)
foreach(_var ${_vars})
string(TOUPPER ${lib} lib_upper)
set(WITH_LIB_${lib_upper}_EXAMPLES "")
if(_var MATCHES "^WITH_LIB_${lib_upper}_EXAMPLE_([A-Za-z]+)$")
message(STATUS "Example found: ${CMAKE_MATCH_1}")
list(APPEND ${WITH_LIB_${lib_upper}_EXAMPLES} ${CMAKE_MATCH_1})
 endif()
endforeach()

message(STATUS "Glad examples: ${WITH_LIB_GLAD_EXAMPLES}")
message(STATUS "GLFW examples: ${WITH_LIB_GLFW_EXAMPLES}")

endmacro()


The problem is that ${WITH_LIB_${lib_upper}_EXAMPLES} is not available
anymore after the foreach, i was not able to find something in the docs
about this, i hope someone here can help me out.


best regrads!



-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] Trouble with CMAKE_EXE_LINKER_FLAGS not honored

2019-06-04 Thread Bryan Christ
For building my project on Linux with gcc I set the following.

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-as-needed")

Later, if, the system appears to be OSX, I change it:

if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")

set(CMAKE_EXE_LINKER_FLAGS "-Wl,-undefined -Wl,dynamic_lookup")
set(CMAKE_PREFIX_PATH /usr/local/opt/ncurses)

endif()

However, when creating the shared object, linking fails.  The flags are not
being passed to clang as expected.  When I dive into
CMakeFile/vterm-shared.dir/link.txt I confirm that the wrong flags are
there.

What am I doing wrong?

-- 
Bryan
<><
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Linking on OSX

2019-06-04 Thread Guy Harris
On Jun 4, 2019, at 10:56 AM, Bryan Christ  wrote:

> Thanks for your suggestions.  I went through that thread pretty thoroughly 
> trying all of the recommended tips and, unfortunately, nothing seemed to 
> work.  I also tried running that open command you cited, but there are still 
> no includes for ncurses in /usr/include or /usr/local/include.

Presumably after you ran the open command you then performed an installation of 
the package from the window that the command popped up?

If not, you need to do that.
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Linking on OSX

2019-06-04 Thread Guy Harris
On Jun 3, 2019, at 3:27 PM, Juan E. Sanchez  wrote:

> It looks like macOS made it so you have to do something like this:
> open 
> /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
> 
> for libraries and includes to be put into /usr.

*Libraries* should exist in /usr/lib regardless of whether you do that, or even 
whether you have Xcode, or the command-line developer tools, installed - if you 
don't have the shared libraries in /usr/lib, programs using the libraries won't 
work, and programs shipped with macOS use, at minimum, libSystem, and may use 
other libraries.  vi, for example, uses the ncurses library.

It's the *headers* that aren't installed in /usr/include by default.  The 
compiler *should* look in the directory where they're installed, however.

Note that macOS 10.15 Catalina apparently has a separate read-only volume that 
contains all the executables and libraries, and presumably including /usr, so 
it may be *impossible* to arrange, on 10.15, that there be a /usr/include 
directory.
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Linking on OSX

2019-06-04 Thread Bryan Christ
Guy,

I would agree with you, but I've been told that OSX is moving away from
it's Unix heritage and placing libraries in non-traditional locations (not
/usr or /usr/local) and that's going to be increasingly the norm in the
future.

https://apple.stackexchange.com/questions/337940/why-is-usr-include-missing-i-have-xcode-and-command-line-tools-installed-moja


On Tue, Jun 4, 2019 at 3:24 PM Guy Harris  wrote:

> On Jun 3, 2019, at 3:27 PM, Juan E. Sanchez 
> wrote:
>
> > It looks like macOS made it so you have to do something like this:
> > open
> /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
> >
> > for libraries and includes to be put into /usr.
>
> *Libraries* should exist in /usr/lib regardless of whether you do that, or
> even whether you have Xcode, or the command-line developer tools, installed
> - if you don't have the shared libraries in /usr/lib, programs using the
> libraries won't work, and programs shipped with macOS use, at minimum,
> libSystem, and may use other libraries.  vi, for example, uses the ncurses
> library.
>
> It's the *headers* that aren't installed in /usr/include by default.  The
> compiler *should* look in the directory where they're installed, however.
>
> Note that macOS 10.15 Catalina apparently has a separate read-only volume
> that contains all the executables and libraries, and presumably including
> /usr, so it may be *impossible* to arrange, on 10.15, that there be a
> /usr/include directory.
> --
>
> 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:
> https://cmake.org/mailman/listinfo/cmake
>


-- 
Bryan
<><
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Linking on OSX

2019-06-04 Thread Guy Harris
On Jun 4, 2019, at 1:33 PM, Bryan Christ  wrote:

> I would agree with you, but I've been told that OSX is moving away from it's 
> Unix heritage and placing libraries in non-traditional locations (not /usr or 
> /usr/local) and that's going to be increasingly the norm in the future.
> 
> https://apple.stackexchange.com/questions/337940/why-is-usr-include-missing-i-have-xcode-and-command-line-tools-installed-moja

That talks about *headers*, not *libraries*.  (Don't be confused by the 
"/Library" used in some path names in that item - /Library has more than 
libraries in it.)

macOS has, all the way back to when it was called "Mac OS X", had a notion of 
"frameworks", which are not installed under /usr/lib, and that contain 
dynamically-linked shared libraries; the higher-level Cocoa APIs, for example, 
are provided as frameworks, as are C libraries such as Core Foundation.

UNIX APIs, however, are, and have always been, implemented as regular 
dynamically-linked shared libraries under /usr/lib.

The executable image for Microsoft Word for Mac has the strings

/usr/lib/libz.1.dylib
/usr/lib/libsqlite3.dylib
/usr/lib/libobjc.A.dylib
/usr/lib/libc++.1.dylib
/usr/lib/libSystem.B.dylib

built into it as library paths; if Apple were to decide to put UNIX libraries 
somewhere other than /usr/lib, and not have a /usr/lib symbolic link pointing 
to the new location, the run-time linker would have to extract the final 
component of paths beginning with /usr/lib and treat them as if they pointed to 
a library in the new location, instead; they could probably do that, but it's 
not clear what the point of doing so would be.

So if somebody were to claim that macOS will be putting *UNIX libraries* (as 
opposed to macOS frameworks, or header files) in some location other than 
/usr/lib, I'd have to ask for some pretty solid evidence to believe that claim; 
I haven't seen any such evidence so far.
-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] Question about looping inside a macro.

2019-06-04 Thread Steven Truppe

Hi everyone, like you know i'm relative new the cmake and i'm working my
way through the book and the documentation but there is something that i
don't understand in the docs.

I just want to write a macro that uses as first argument a list and then
iterates over it.

The docs show the example:

macro(_BAR)
  foreach(arg IN LISTS ARGN)
[...]
  endforeach()
endmacro()

So i wrote this macro:

macro(bsPrintList list)

    foreach(l IN LISTS ARGN)

        message(STATUS "List entry: ${l})

    endforeach()

endmacro()


I tried all sorts of combinations like foreach(l ${list}) etc. but come
to no result =(.


This is a really easy questin so i hope someone can explain to me what
i'm doing wrong here, next part i'm going to learn are functions and how
to handle their arguments...


best regards!

-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Linking on OSX

2019-06-04 Thread Bryan Christ
Yes.  Unfortunately, I still don't get the wide version of ncurses so I
have to point elsewhere.  But even assuming that solved my problem , I
understand the procedure is a stop-gap and might not eventually be
supported.

On Tue, Jun 4, 2019 at 4:01 PM Guy Harris  wrote:

> On Jun 4, 2019, at 10:56 AM, Bryan Christ  wrote:
>
> > Thanks for your suggestions.  I went through that thread pretty
> thoroughly trying all of the recommended tips and, unfortunately, nothing
> seemed to work.  I also tried running that open command you cited, but
> there are still no includes for ncurses in /usr/include or
> /usr/local/include.
>
> Presumably after you ran the open command you then performed an
> installation of the package from the window that the command popped up?
>
> If not, you need to do that.
>


-- 
Bryan
<><
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Linking on OSX

2019-06-04 Thread Bryan Christ
Thanks for the explanation.  Yes.  The use of the term Library certainly
added to my confusion.  I've been coding on Linux for 20 and the "proper"
way of doing things on Mac is a bit elusive to me as I stumble around.



On Tue, Jun 4, 2019 at 4:21 PM Guy Harris  wrote:

> On Jun 4, 2019, at 1:33 PM, Bryan Christ  wrote:
>
> > I would agree with you, but I've been told that OSX is moving away from
> it's Unix heritage and placing libraries in non-traditional locations (not
> /usr or /usr/local) and that's going to be increasingly the norm in the
> future.
> >
> >
> https://apple.stackexchange.com/questions/337940/why-is-usr-include-missing-i-have-xcode-and-command-line-tools-installed-moja
>
> That talks about *headers*, not *libraries*.  (Don't be confused by the
> "/Library" used in some path names in that item - /Library has more than
> libraries in it.)
>
> macOS has, all the way back to when it was called "Mac OS X", had a notion
> of "frameworks", which are not installed under /usr/lib, and that contain
> dynamically-linked shared libraries; the higher-level Cocoa APIs, for
> example, are provided as frameworks, as are C libraries such as Core
> Foundation.
>
> UNIX APIs, however, are, and have always been, implemented as regular
> dynamically-linked shared libraries under /usr/lib.
>
> The executable image for Microsoft Word for Mac has the strings
>
> /usr/lib/libz.1.dylib
> /usr/lib/libsqlite3.dylib
> /usr/lib/libobjc.A.dylib
> /usr/lib/libc++.1.dylib
> /usr/lib/libSystem.B.dylib
>
> built into it as library paths; if Apple were to decide to put UNIX
> libraries somewhere other than /usr/lib, and not have a /usr/lib symbolic
> link pointing to the new location, the run-time linker would have to
> extract the final component of paths beginning with /usr/lib and treat them
> as if they pointed to a library in the new location, instead; they could
> probably do that, but it's not clear what the point of doing so would be.
>
> So if somebody were to claim that macOS will be putting *UNIX libraries*
> (as opposed to macOS frameworks, or header files) in some location other
> than /usr/lib, I'd have to ask for some pretty solid evidence to believe
> that claim; I haven't seen any such evidence so far.
>


-- 
Bryan
<><
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Linking on OSX

2019-06-04 Thread Guy Harris
On Jun 4, 2019, at 2:27 PM, Bryan Christ  wrote:

> Thanks for the explanation.  Yes.  The use of the term Library certainly 
> added to my confusion.  I've been coding on Linux for 20 and the "proper" way 
> of doing things on Mac is a bit elusive to me as I stumble around.

Yeah, it must be weird going from a system that stuffs libraries in /usr/lib64 
to a system that stuffs them in /usr/lib. :-)

(There's no need to put 32-bit and 64-bit libraries in separate directories if 
you can put the 32-bit and 64-bit versions of a library in the same file, as 
you can in Darwin.

But the real point is that every UN*X has its own quirks, and somebody might 
find the UN*X with which you're most familiar to be the quirky one.  If you're 
going to do cross-platform UN*X programming, be prepared to have assumptions 
about UN*X, made based on the platform or platforms with which you're familiar, 
to be violated by some other UN*X.)
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Question about looping inside a macro.

2019-06-04 Thread Bruce Stephens
This works:
macro(bsPrintList)
  foreach(l ${ARGN})
message(STATUS "List entry: ${l}")
  endforeach()
endmacro()

bsPrintList(foo bar baz)

On Tue, 4 Jun 2019 at 22:14, Steven Truppe  wrote:
>
> Hi everyone, like you know i'm relative new the cmake and i'm working my way 
> through the book and the documentation but there is something that i don't 
> understand in the docs.
>
> I just want to write a macro that uses as first argument a list and then 
> iterates over it.
>
> The docs show the example:
>
> macro(_BAR)
>   foreach(arg IN LISTS ARGN)
> [...]
>   endforeach()
> endmacro()
>
> So i wrote this macro:
>
> macro(bsPrintList list)
>
> foreach(l IN LISTS ARGN)
>
> message(STATUS "List entry: ${l})
>
> endforeach()
>
> endmacro()
>
>
> I tried all sorts of combinations like foreach(l ${list}) etc. but come to no 
> result =(.
>
>
> This is a really easy questin so i hope someone can explain to me what i'm 
> doing wrong here, next part i'm going to learn are functions and how to 
> handle their arguments...
>
>
> best regards!
>
> --
>
> 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:
> https://cmake.org/mailman/listinfo/cmake
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Linking on OSX

2019-06-04 Thread Bryan Christ
Indeed.  They all have their nuances :)

On Tue, Jun 4, 2019 at 4:36 PM Guy Harris  wrote:

> On Jun 4, 2019, at 2:27 PM, Bryan Christ  wrote:
>
> > Thanks for the explanation.  Yes.  The use of the term Library certainly
> added to my confusion.  I've been coding on Linux for 20 and the "proper"
> way of doing things on Mac is a bit elusive to me as I stumble around.
>
> Yeah, it must be weird going from a system that stuffs libraries in
> /usr/lib64 to a system that stuffs them in /usr/lib. :-)
>
> (There's no need to put 32-bit and 64-bit libraries in separate
> directories if you can put the 32-bit and 64-bit versions of a library in
> the same file, as you can in Darwin.
>
> But the real point is that every UN*X has its own quirks, and somebody
> might find the UN*X with which you're most familiar to be the quirky one.
> If you're going to do cross-platform UN*X programming, be prepared to have
> assumptions about UN*X, made based on the platform or platforms with which
> you're familiar, to be violated by some other UN*X.)



-- 
Bryan
<><
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Trouble with CMAKE_EXE_LINKER_FLAGS not honored

2019-06-04 Thread Tom Finegan via CMake
I think you want CMAKE_SHARED_LINKER_FLAGS:

https://cmake.org/cmake/help/latest/variable/CMAKE_SHARED_LINKER_FLAGS.html

You can also use target_link_libraries to pass linker flags:

https://cmake.org/cmake/help/latest/command/target_link_libraries.html

On Tue, Jun 4, 2019 at 1:12 PM Bryan Christ  wrote:

> For building my project on Linux with gcc I set the following.
>
> set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-as-needed")
>
> Later, if, the system appears to be OSX, I change it:
>
> if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
>
> set(CMAKE_EXE_LINKER_FLAGS "-Wl,-undefined -Wl,dynamic_lookup")
> set(CMAKE_PREFIX_PATH /usr/local/opt/ncurses)
>
> endif()
>
> However, when creating the shared object, linking fails.  The flags are
> not being passed to clang as expected.  When I dive into
> CMakeFile/vterm-shared.dir/link.txt I confirm that the wrong flags are
> there.
>
> What am I doing wrong?
>
> --
> Bryan
> <><
> --
>
> 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:
> https://cmake.org/mailman/listinfo/cmake
>
-- 

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:
https://cmake.org/mailman/listinfo/cmake


[CMake] Troubles with small CMakeLists.txt

2019-06-04 Thread Steven Truppe

Hi everyone,

i finaly have solved the issues i had and now have the working code on:
https://wandbox.org/permlink/ujEH8F91SVzMyt1D


The problem is that the i only get the last result as output, he create
the variables and stores them (i tested with cmake_print_variables) but
at the end the resulting variables are empty - only the last one is
correct

I hope someone here can help.


best regards!

--

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Troubles with small CMakeLists.txt

2019-06-04 Thread Steven Truppe

I've made the code more readable and easy to understand so you don't
have to read through all the code:
https://wandbox.org/permlink/qp7ScGBeMOtolfxb

On 05.06.19 00:47, Steven Truppe wrote:

Hi everyone,

i finaly have solved the issues i had and now have the working code on:
https://wandbox.org/permlink/ujEH8F91SVzMyt1D


The problem is that the i only get the last result as output, he create
the variables and stores them (i tested with cmake_print_variables) but
at the end the resulting variables are empty - only the last one is
correct

I hope someone here can help.


best regards!


--

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Linking on OSX

2019-06-04 Thread Juan E. Sanchez

Hello,

It looks like you are making progress.  Note that to use the gcc-8 and 
g++-8 compilers from brew, you need to have include files in 
/usr/include.  Otherwise you get strange errors about missing _stdio.h, 
etc.  I believe in another thread, someone suggests how to make sure the 
headers get put in the right place.


I looked and found curses.h (not ncurses.h) here.
/usr/include/curses.h.

Regards,

Juan


On 6/4/19 12:56 PM, Bryan Christ wrote:

Juan,

Thanks for your suggestions.  I went through that thread pretty 
thoroughly trying all of the recommended tips and, unfortunately, 
nothing seemed to work.  I also tried running that open command you 
cited, but there are still no includes for ncurses in /usr/include or 
/usr/local/include.  In fact /usr/include doesn't even exist on this 
system (mojave).


On Mon, Jun 3, 2019 at 5:27 PM Juan E. Sanchez > wrote:


Hello,

According to this:
https://github.com/neovim/neovim/issues/9050

It looks like macOS made it so you have to do something like this:
open

/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

for libraries and includes to be put into /usr.

Regards,

Juan


On 6/3/19 5:16 PM, Bryan Christ wrote:
 > New to this mailing list so I hope I'm asking this in the right
venue...
 >
 > I'm trying to port my application (a program and a shared
library) to
 > OSX.  It was rather easy to modify my CMake script to go from
Linux and
 > add in FreeBSD.  OSX is giving me a lot of problems though.
 >
 > First of all find_package() doesn't seem to find the ncurses.dylib
 > installed by XCode as it test for wsyncup().  For whatever
reason, that
 > test fails.  The default location for the library is pretty sane
 > (/usr/lib/) but the include file for ncurses is about 9
directories deep
 > inside of XCode's install directory.  Lots of problems here so I
decided
 > to look at the symbol linkage for htop and see what it does.  It
links
 > to a different version that got pulled down via homebrew in
 > /usr/local/opt/ncurses/lib (and include respectively)
 >
 > Is there a way to force CMake to link to the library found there
instead
 > of in /usr/lib/ ?
 >
 > --
 > Bryan
 > <><
 >

-- 


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:
https://cmake.org/mailman/listinfo/cmake



--
Bryan
<><


--

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Troubles with small CMakeLists.txt

2019-06-04 Thread Stephan.Szabo
Hi,

Looking at the cmake there, your bsBuildLibExamples macro starts off by doing
   set(WITH_LIB_${lib_upper}_EXAMPLES "")
but lib_upper isn't set to match the new value of lib until later inside the 
foreach.
So it seems like you're resetting the value of the previous iteration.

Moving the 
  string(TOUPPER ${lib} lib_upper)
to the top of the macro seems to make all the variables show up.

Regards,
Stephan

-Original Message-
From: CMake  On Behalf Of Steven Truppe
Sent: Tuesday, June 4, 2019 3:56 PM
To: cmake@cmake.org
Subject: Re: [CMake] Troubles with small CMakeLists.txt

I've made the code more readable and easy to understand so you don't have to 
read through all the code:
https://wandbox.org/permlink/qp7ScGBeMOtolfxb

On 05.06.19 00:47, Steven Truppe wrote:
> Hi everyone,
>
> i finaly have solved the issues i had and now have the working code on:
> https://wandbox.org/permlink/ujEH8F91SVzMyt1D
>
>
> The problem is that the i only get the last result as output, he 
> create the variables and stores them (i tested with 
> cmake_print_variables) but at the end the resulting variables are 
> empty - only the last one is correct
>
> I hope someone here can help.
>
>
> best regards!
>
-- 

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:
https://cmake.org/mailman/listinfo/cmake
-- 

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:
https://cmake.org/mailman/listinfo/cmake


Re: [CMake] Troubles with small CMakeLists.txt

2019-06-04 Thread Steven Truppe

That was the issue - thanks alot for you help, i'm sitting now for over
5 hours in front of cmake and my eyes need some rest (and more brain
needs more cmake knowledge:).


best regards!

On 05.06.19 01:13, stephan.sz...@sony.com wrote:

Hi,

Looking at the cmake there, your bsBuildLibExamples macro starts off by doing
set(WITH_LIB_${lib_upper}_EXAMPLES "")
but lib_upper isn't set to match the new value of lib until later inside the 
foreach.
So it seems like you're resetting the value of the previous iteration.

Moving the
   string(TOUPPER ${lib} lib_upper)
to the top of the macro seems to make all the variables show up.

Regards,
Stephan

-Original Message-
From: CMake  On Behalf Of Steven Truppe
Sent: Tuesday, June 4, 2019 3:56 PM
To: cmake@cmake.org
Subject: Re: [CMake] Troubles with small CMakeLists.txt

I've made the code more readable and easy to understand so you don't have to 
read through all the code:
https://wandbox.org/permlink/qp7ScGBeMOtolfxb

On 05.06.19 00:47, Steven Truppe wrote:

Hi everyone,

i finaly have solved the issues i had and now have the working code on:
https://wandbox.org/permlink/ujEH8F91SVzMyt1D


The problem is that the i only get the last result as output, he
create the variables and stores them (i tested with
cmake_print_variables) but at the end the resulting variables are
empty - only the last one is correct

I hope someone here can help.


best regards!


--

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:
https://cmake.org/mailman/listinfo/cmake