[ITK-dev] Not linking against libpython

Bradly Lowekamp blowekamp at mail.nih.gov
Thu Mar 24 10:16:58 EDT 2016


> On Mar 23, 2016, at 4:27 PM, Brad King <brad.king at kitware.com> wrote:
> 
> On 03/23/2016 04:16 PM, Bradley Lowekamp wrote:
>> 1) Is there a more CMAKE-ic way for doing this?
>>   With all they library and linking properties?
> 
> I'm not certain what you're asking because if you don't want to link
> to a library then don't pass it to target_link_libraries and then
> propagation doesn't matter.  What role do you think CMake might play
> in doing this?

I thought that there may have been something I was missing with options to target_link_librares options or the MODULE options in add_libraries.

What role could it?
1) There could be a target property corresponding to if undefined symbols are allowed. It would be true for this case of linux, where it defaults to allowing undefined symbols. Conversely OSX does not allow undefined symbols by default but has a flag to enable them.
2) There could be an additional target_link_library keyword to specify the type of linking, say “WEAK”. This could cause a SHARED or MODULE target to to be linked against this library if undefined symbols are NOT allowed.
3) This is the first case I have seen where a MODULE library target, as in one intended to be dynamically loaded, should be handled differently.



> 
>> 2) Is there a way to know if the linker allows undefined symbols
>>   for shared libraries?
> 
> CMake does not provide this information directly.  You could use a
> try_compile to test it.

Do you know of a try_compile example which creates a shared library? 

Just need to compile and link this as a shared library:  ”extern int bar(void); int foo(void) {return bar()+1;}”

Lastly I am working on a couple experiments here: https://github.com/blowekamp/CMakeSecondaryDependencies

Thanks!
Brad

> 
> -Brad K
> 



More information about the Insight-developers mailing list