[CMake] How to set gcc option "-Wl,-rpath-link," in CMake?make

2016-06-06 Thread Chaos Zhang
Hi, all, i am trying to converting an existed make project into CMake project, and there are some gcc link options i should convert. Not long ago, Mr. Atkins told me 'RPATHs are automatically added by CMake to executables so they can use libraries from the build tree.'. Now i don't know weather

[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

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

2016-05-31 Thread Chaos Zhang
need the > actual file name but they are uncommon and even then you would do it > through target properties and generator expressions rather than hard code > the library file name. > > - Chuck > > On Mon, May 30, 2016 at 8:35 AM, Chaos Zhang > zcsd2012@ > wro

[CMake] How to link shared lib on windows (visual studio 2014).

2016-04-25 Thread Chaos Zhang
Hi, I faced this problem when i try built a shared lib and linked it on windows. The structure of my project as below: -test_dir/ -sub_hello/ CMakeLists.txt hello.c -top/ main.c CMakeLists.txt CMakeLists.txt The content of each file:

[CMake] CMake:question of the time when the command will happen in add_custom_command(...)

2016-04-21 Thread Chaos Zhang
Hi all, I have some trouble when i use PRE_BUILD | PRE_LINK | POST_BUILD in command "add_custom_command(...)". When i use POST_BUILD, i found the command will execute before target had been built, like this: 1 [root@VM_33_35_centos build]# make 2 Scanning dependencies of target main 3 [100%]

Re: [CMake] CMake:question of the time when the command will happen in add_custom_command(...)

2016-04-22 Thread Chaos Zhang
et main"); > } > > The custom command becomes a part of the entire process of "Building > target," that's why the "Built target" message appears after the command > runs. > > BTW, please keep the mailing list in copy when replying. > > Petr &

Re: [CMake] How to link shared lib on windows (visual studio 2014).

2016-04-26 Thread Chaos Zhang
CLI options, etc) since I find the options to CMake to >> be >> > very... verbose. >> > >> > The POST_BUILD example is here: >> > >> > >> https://github.com/calebwherry/example-cmake-project/blob/master/src/app/test-app/CMakeLists.txt >>

Re: [CMake] How to link shared lib on windows (visual studio 2014).

2016-04-26 Thread Chaos Zhang
ong run and doesn't work as an actual solution > to > the problem if you are trying to solve it for many projects. > > -Caleb > > On Mon, Apr 25, 2016 at 9:01 PM, Chaos Zhang > zcsd2012@ > wrote: > >> Hi, >> >> I faced this problem when i try bu

[CMake] How to transfer CMake variable and include other makefile in one makefile which generated by CMake

2016-04-23 Thread Chaos Zhang
Hi all, I faced this problem when i converting an existing Makefile to CMake. I have try my best to search this problem in google and stack overflow but finally failed for my poor English.In the existing makefile, the content like as below: var=test_var include(test.mk) What i want to do

Re: [CMake] Need a example to use dll in vs

2016-04-24 Thread Chaos Zhang
step" as part of my > cmake process. Then I make sure the builds' install area is in the path > of the application. > > The issue may be your EXE cant find the DLL in its path. > > Scott > > -Original Message- > From: CMake [mailto: > cmake-bounces@ > ] On B

[CMake] Need a example to use dll in vs

2016-04-24 Thread Chaos Zhang
Hi all, I faced a problem when i migrate a project from Linux to windows for the visual stdio seem can not use dll directly. I look through a number of material and known i seem should use IMPORTED in add_library(...), but i can not find a practical example about how to use it. Could you please

[CMake] Exe file can't find .dll file on windows

2016-04-25 Thread Chaos Zhang
Hi, all, At first i was struggled to solve the problem of link shared lib on windows by CMake, and i found solution by using set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES). But when i executed the exe file, an error occurred: "The program can't start because hello_lib.dll is missing from your

Re: [CMake] Need a example to use dll in vs

2016-04-25 Thread Chaos Zhang
do, and what is failing. > > Sincerely, > Jakob van Bethlehem > > On Mon, Apr 25, 2016 at 5:13 AM, Chaos Zhang > zcsd2012@ > wrote: > >> Hi all, >> >> I faced a problem when i migrate a project from Linux to windows for the >> visual stdio se

Re: [CMake] How to use 'CMAKE_EXE_LINKER_FLAGS' correctly

2016-05-20 Thread Chaos Zhang
XE_LINKER_FLAGS. > > - Chuck > > On Fri, May 20, 2016 at 4:28 AM, Chaos Zhang > zcsd2012@ > wrote: > >> Hi, all, >> >> I try to use some gcc link option and libs(except libs link by >> target_link_libraries(...)), i researched and try to use >>

[CMake] How to use 'CMAKE_EXE_LINKER_FLAGS' correctly

2016-05-20 Thread Chaos Zhang
Hi, all, I try to use some gcc link option and libs(except libs link by target_link_libraries(...)), i researched and try to use 'CMAKE_EXE_LINKER_FLAGS' in a simple project, as below: in dir, there are 5 files: -hello.h -hello.c -main.c -hello.o -libhello.a hello.o was compiled by hello.c(gcc

Re: [CMake] How to use 'CMAKE_EXE_LINKER_FLAGS' correctly

2016-05-23 Thread Chaos Zhang
Thanks a lot! `set(FOO_LIBRARY "-Wl,--whole-archive ${FOO_LIBRARY} -Wl,--no-whole-archive")` worked when the content of ${FOO_LIBRARY} look like `-Ldir -llib`, if just use lib name as the content of ${FOO_LIBRARY}, error while occur. Chuck Atkins wrote >> -rpath > > > RPATHs are automatically

Re: [CMake] How to use 'CMAKE_EXE_LINKER_FLAGS' correctly

2016-05-24 Thread Chaos Zhang
to/foo/libfoo.a (or .so if it's shared) instead of -L/path/to/foo > -lfoo. CMake will adjust the flags to -L and -l if needed but the > preference is always to use the full library path. > > - Chuck > > On Mon, May 23, 2016 at 2:23 AM, Chaos Zhang > zcsd2012@ > w

[CMake] Linking CXX executable xxx :undefined reference to `stlp_std::cout'

2016-05-16 Thread Chaos Zhang
Hi all, I was trying to convert an existed c++ project to CMake. The existed worked well with makefile, and i have converted similar one successfully. but when i try to convert this one, some confusing errors occurred, as below: 18:22:10: Running steps for project encryption... 18:22:10:

[CMake] CMake: how to use 'for cyclic sentence' in command add_custom_command(...)

2016-04-19 Thread Chaos Zhang
Hi, I was using 'for cyclic sentence' in command add_custom_command(...), the content of the CMakeLists.txt as below: add_custom_command(TARGET temp_target POST_BUILD COMMAND for x in a b c\; do echo

Re: [CMake] CMake: how to use 'if condition' in command add_custom_command(...)

2016-04-19 Thread Chaos Zhang
quot;, if POST_BUILD gets treated as PRE_LINK, why "3_pre_build" was printed before "1_pre_link"? Thanks for you reply, Chaos Zhang ​ 2016-04-19 15:50 GMT+08:00 Craig Scott-3 [via CMake] < ml-node+s3232098n7593281...@n2.nabble.com>: > In case it matters, in Clark's su

[CMake] CMake: how to use 'if condition' in command add_custom_command(...)

2016-04-18 Thread Chaos Zhang
Hi, Is there a way to use Linux command 'if' like this : <http://cmake.3232098.n2.nabble.com/file/n7593278/2016-04-19_113005.png> For i need to execute 'if condition' in make phase rather than cmake phase. Thanks a lot Chaos Zhang -- View this message in context: http://cmake.3

Re: [CMake] Does Makefile generated by CMake support make -jN?

2016-07-14 Thread Chaos Zhang
Hi, Chuck, Thanks for your generous help. Actually there is no make -j option in the already exist make flow of my project as i know so far. Because i have read the makefiles in detail, and when i make my project, the sub projects in my project executed in order. The problem i found is it

Re: [CMake] Does Makefile generated by CMake support make -jN?

2016-07-12 Thread Chaos Zhang
hao, > > > On Wed, Jul 13, 2016 at 10:54 AM, Chaos Zhang > zcsd2012@ > wrote: >> I was trying to compile my project using CMake, after CMake generated >> Makefile. >> I used `/usr/bin/time -v make` to make the Makefile, got the result: >> 'Percent of CPU this job g

[CMake] Does Makefile generated by CMake support make -jN?

2016-07-12 Thread Chaos Zhang
Hi, all, I was trying to compile my project using CMake, after CMake generated Makefile. I used `/usr/bin/time -v make` to make the Makefile, got the result: 'Percent of CPU this job got: 96%'. Then i used `/usr/bin/time -v make -j8` to make the Makefile, the result of CPU used is 'Percent of

Re: [CMake] Does Makefile generated by CMake support make -jN?

2016-07-13 Thread Chaos Zhang
, Chao J Decker wrote > On Tue, Jul 12, 2016 at 7:54 PM, Chaos Zhang > zcsd2012@ > wrote: > >> Hi, all, >> >> I was trying to compile my project using CMake, after CMake generated >> Makefile. >> I used `/usr/bin/time -v make` to make the Makefile, got t

Re: [CMake] Does Makefile generated by CMake support make -jN?

2016-07-13 Thread Chaos Zhang
CMake. Thanks again, Chao Andrew Melo wrote > On Tue, Jul 12, 2016 at 10:48 PM, Chaos Zhang > zcsd2012@ > wrote: >> Thanks for your reply Raymond, by 'If you got 96% both times, then I >> would >> say there's a problem.', did you mean if make performed like this

Re: [CMake] Does Makefile generated by CMake support make -jN?

2016-07-17 Thread Chaos Zhang
make -j" option in CMake file? For i use Qt Creator as IDE, and the CMake compile system is provided for other R teams, so i want to make the CMake compile system as simply and automatically as i can. Could you please give me some advice? Thanks again, Chao Chaos Zhang wrote > Hi, Chuck, >

[CMake] How to assign specific c, c++, fortran compiler and does CMake support Intel C/C++/Fortran Compiler?

2016-07-01 Thread Chaos Zhang
Hi, all, First, thanks for review my email. There are two questions i faced now: 1. I faced problem to assign specific compiler in CMake, and i searched for a while then i found [ CC="Foo\gcc.exe" CXX="Foo\g++.exe" cmake . ] seem work. Now i use CMake in QtCreator, is there other way i can

[CMake] Why a foo.dll.a generated when i build shared lib foo.dll or foo.exe file?

2016-06-19 Thread Chaos Zhang
Hi,all, I am working on transferring an existed make project into cmake, and the platform is MinGW(32 bit) on windows. The make flow to build foo.dll or foo.exe would not generate foo.dll.a, but when i use CMake, this generated. I was wondering if this foo.dll.a is necessary, and if it is not