Re: [CMake] How to hundle gcc link options(like whole-archive, --allow-multiple-definition) in CMake?

2016-05-31 Thread Chaos Zhang
Thanks for your generous Mr. Atkins, what you answer me worked well and solved my question. I would keep 'always use target names in a CMakeLists.txt instead of the actual output file' in my mind. :-) Chao Chuck Atkins wrote > Hi Chao, > > You want to let CMake to as much of the work for you as

Re: [CMake] How to hundle gcc link options(like whole-archive, --allow-multiple-definition) in CMake?

2016-05-31 Thread Chuck Atkins
Hi Chao, You want to let CMake to as much of the work for you as possible. You're still trying to explicitly pass the path to the library file to target_link_libraries. If you look at the line: target_link_library(exe1 "-Wl, --whole-archive ../sub_dir1/liblib1.a --no-whole-archive") there's no

[CMake] How to hundle gcc link options(like whole-archive, --allow-multiple-definition) in CMake?

2016-05-30 Thread Chaos Zhang
Hi, all, Thanks for taking your time to review my email. I have a demo project and it's structure like as below: top_dir CMakeLists.txt sub_dir1 CMakeLists.txt sub_dir2 CMakeLists.txt top_dir/sub_dir1/CMakeLists.txt used to build `lib1` by using `add_library(lib1 ...)