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

2016-04-26 Thread Chaos Zhang
Thanks again Mr. Atkins. Chuck Atkins wrote > May others have mentioned the various different ways to address generating > import libraries. One thing that will help with the "can't find .dll" > issue is to change the default location that various components end up. > With Windows shared

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

2016-04-26 Thread Chuck Atkins
May others have mentioned the various different ways to address generating import libraries. One thing that will help with the "can't find .dll" issue is to change the default location that various components end up. With Windows shared libraries, you have both a runtime component (.dll) and a

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

2016-04-26 Thread Chaos Zhang
Hi, all, Thanks for your sincerely help, and i understand it clearly now. ( ^_^ ) Best regards, Chao J. Caleb Wherry wrote > (Shameless plug ahead) > > If you want to see a working example of what I said above, you can check > out my ExampleCMakeProject: > >

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

2016-04-25 Thread J. Caleb Wherry
(Shameless plug ahead) If you want to see a working example of what I said above, you can check out my ExampleCMakeProject: https://github.com/calebwherry/example-cmake-project It is currently being built and tested on TravisCI (Linux + Mac [GGC5 and Clang3.7]) and Appveyor (Windows [VS2015])

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

2016-04-25 Thread J. Caleb Wherry
Altering the path, updating the registry, or having a custom install step that installs into a build location are all options that aren't scalable since they apply specifically to the one project. Paths would get huge if this was to be done in practice for multiple projects. Also, the OP seems to

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

2016-04-25 Thread J Decker
On Apr 25, 2016 6:41 PM, "J. Caleb Wherry" wrote: > > (1) > > You typically want to define the entry point in the source itself. You can use the 'CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS' in CMake but you usually do something like this in the source: > > #ifdef WIN32 > #define

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

2016-04-25 Thread Craig Scott
Also see the GenerateExportHeader module which can handle much of this for you in a more platform independent way. The examples in the docs talk about classes, but it can also be applied to functions. On Tue, Apr 26, 2016 at

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

2016-04-25 Thread J. Caleb Wherry
(1) You typically want to define the entry point in the source itself. You can use the 'CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS' in CMake but you usually do something like this in the source: #ifdef WIN32 #define PUBLIC_API __declspec(dllexport) #else #define PUBLIC_API #endif PUBLIC_API void

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

2016-04-25 Thread J Decker
Add __declspec(dllexport) before void HelloFunc() On Apr 25, 2016 6:01 PM, "Chaos Zhang" wrote: > 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/ >