Re: [CMake] Trouble with CMAKE_EXE_LINKER_FLAGS not honored

2019-06-05 Thread Bryan Christ
Tom,

That was a really helpful tip.  At least as far as building goes, I've
ported my app.  Now on to debugging the system nuances.

Ty!

On Wed, Jun 5, 2019 at 12:13 PM Tom Finegan  wrote:

>
> On Wed, Jun 5, 2019 at 9:29 AM Bryan Christ 
> wrote:
>
>> Tom,
>>
>> I'll give that a try.  Can that variable be changed after project() is
>> called?
>>
>
> Yes, you should be able to change it at any point in your CMake script(s).
>
> Remember that CMAKE__LINKER_FLAGS will effect all targets.
> Restricting your settings changes to the targets for which they are
> intended is usually better than touching variables like
> CMAKE_SHARED_LINKER_FLAGS.  You may have better results using
> target_link_libraries() to set your flags.
>
>
>>
>> On Tue, Jun 4, 2019 at 5:24 PM Tom Finegan  wrote:
>>
>>> 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

>>>
>>
>> --
>> Bryan
>> <><
>>
>

-- 
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-05 Thread Tom Finegan via CMake
On Wed, Jun 5, 2019 at 9:29 AM Bryan Christ  wrote:

> Tom,
>
> I'll give that a try.  Can that variable be changed after project() is
> called?
>

Yes, you should be able to change it at any point in your CMake script(s).

Remember that CMAKE__LINKER_FLAGS will effect all targets.
Restricting your settings changes to the targets for which they are
intended is usually better than touching variables like
CMAKE_SHARED_LINKER_FLAGS.  You may have better results using
target_link_libraries() to set your flags.


>
> On Tue, Jun 4, 2019 at 5:24 PM Tom Finegan  wrote:
>
>> 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
>>>
>>
>
> --
> 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-05 Thread Bryan Christ
Tom,

I'll give that a try.  Can that variable be changed after project() is
called?

On Tue, Jun 4, 2019 at 5:24 PM Tom Finegan  wrote:

> 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
>>
>

-- 
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] 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