Hi,

I'm defining a static library target and, conditionally, when on windows, I
need to pass a whole bunch of windows system libraries and tell Visual
Studio that any target linking against this static library should pass
additional linker flags ( `\NODEFAULTLIB:libcd \INCREMENTAL:NO` ). I tried
setting the LINKER_FLAGS property on the target with

    +  set_property(TARGET ECI_C
    +    PROPERTY
    +    APPEND
    +    LINK_FLAGS "${prefix}NODEFAULTLIB${colon}\"libcd\"")
    +    set_property(TARGET ECI_C
    +    PROPERTY
    +    APPEND
    +    LINK_FLAGS "${prefix}INCREMENTAL${colon}NO")

however, these flags did not seem to get transitively propagated to the
executable linking against this ECI_C static library. Am I doing something
wrong, or should I just specify the flags through the
`target_link_libraries( ECI_C INTERFACE FLAG1 FLAG2 )` command?  What's the
"right"/canonical way to do this?

Also, I'm extremely new to developing on Windows with MSVS, and I'm writing
CMake files to generate visual studio projects to more or less match some
that have been manually written. Without ignoring the `libcd` library I get
linker errors like

    error LNK2019: unresolved external symbol __imp_fopen

Which seems strange that I should have to ignore the standard C debug
library to fix. Without the `\INCREMENTAL:NO` flag I get warnings like

   warning LNK4217: locally defined symbol malloc imported in function
inittask

Are the manually written VS solution files or source code that I've
inherited doing something silly that requires these MSVS linker flags to be
set? It feels like this, along with the sheer quantity of system libraries
that are being passed to the linker may be a bit of a cludge. I'm
wondering, if it's worth spending my limited time investigating this
further or is this expected/common-practice/acceptable usage?

Thanks,
Zaak

Izaak "Zaak" Beekman

-------------------------------------------------------------------------------

HPC Scientist
ParaTools Inc. <http://www.paratools.com/>
1509 16th St, NW
Washington, DC 20036
mobile: (917) 797-3239
-------------------------------------------------------------------------------
-- 

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

Reply via email to