[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 computer. Try
reinstalling to fix this problem." And after i copy hello_lib.dll to the
folder of exe file, it worked.

Thanks,
Chao Zhang



--
View this message in context: 
http://cmake.3232098.n2.nabble.com/Exe-file-can-t-find-dll-file-on-windows-tp7593334.html
Sent from the CMake mailing list archive at Nabble.com.
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake


Re: [CMake] Version compatibility?

2016-04-25 Thread Johannes Zarl-Zierl
Hi Rob,

I've stopped working on it when 3.0 came out. Since the whole thing was very 
much manual work (diff'ing documentation pages and checking whether some 
change was only better documentation or a real change in cmake), it was too 
much effort to continue long-term.

  Johannes

On Saturday 23 April 2016 10:32:15 Rob McDonald wrote:
> Is there a continuation of the CMake version -- feature mapping table?
> 
> https://cmake.org/Wiki/CMake_Version_Compatibility_Matrix
> 
> I found this to be quite useful, but need something that continues into 3.X.
> 
> Rob

-- 

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:
http://public.kitware.com/mailman/listinfo/cmake


Re: [CMake] Version compatibility?

2016-04-25 Thread Craig Scott
I personally have found myself having to look up to his sort of version
info a lot lately. It sounds like others do too. Perhaps a more sustainable
approach would be to include the version details in the CMAKE docs
themselves. For each command, module, variable, etc. it's documentation
could state the version it was added. Some may warrant further info for
version(s) where significant changes were made (eg keywords added to a
command). Realistically, it would have to be done progressively and
obviously with agreement from the Kitware side. It would only work if it
became part of the change process whereby any new features or changes must
include such version details. It would be interesting to hear what Kitware
think of the idea. Any chance?



On Monday, 25 April 2016, Johannes Zarl-Zierl 
wrote:

> Hi Rob,
>
> I've stopped working on it when 3.0 came out. Since the whole thing was
> very
> much manual work (diff'ing documentation pages and checking whether some
> change was only better documentation or a real change in cmake), it was too
> much effort to continue long-term.
>
>   Johannes
>
> On Saturday 23 April 2016 10:32:15 Rob McDonald wrote:
> > Is there a continuation of the CMake version -- feature mapping table?
> >
> > https://cmake.org/Wiki/CMake_Version_Compatibility_Matrix
> >
> > I found this to be quite useful, but need something that continues into
> 3.X.
> >
> > Rob
>
> --
>
> 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:
> http://public.kitware.com/mailman/listinfo/cmake
>


-- 
Craig Scott
Melbourne, Australia
http://crascit.com
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

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

2016-04-25 Thread Jakob van Bethlehem
Hej,

You really should provide more detailed information about your project
structure, and what is going wrong. There are some subtle differences
between Linux/Windows, but not at the level you're referring to. Certainly
the IMPORTED property has nothing to do with a platform distinction.
IMPORTED libraries work exactly the same on Windows/Linux.

There is a very big difference between Linux/Windows though in the sense
that on Windows you need to explicitly export symbols you want to be
available on the interface of the dll. My first guess from your very
limited info is that something is wrong in that area (and if that's the
case, you can easily resolve this using the GenerateExportHeader module).

But back to my original comment: provide more details on what you are
trying to do, and what is failing.

Sincerely,
Jakob van Bethlehem

On Mon, Apr 25, 2016 at 5:13 AM, Chaos Zhang  wrote:

> 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 give
> me one or some? BTW the dll lib seem could be used in Mingw makefile on
> windows.
>
> Thanks,
> Chao Zhang
>
>
>
> --
> View this message in context:
> http://cmake.3232098.n2.nabble.com/Need-a-example-to-use-dll-in-vs-tp7593331.html
> Sent from the CMake mailing list archive at Nabble.com.
> --
>
> 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:
> http://public.kitware.com/mailman/listinfo/cmake
>
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] Version compatibility?

2016-04-25 Thread Nils Gladitz

On 04/25/2016 02:29 PM, Craig Scott wrote:
I personally have found myself having to look up to his sort of 
version info a lot lately. It sounds like others do too. Perhaps a 
more sustainable approach would be to include the version details in 
the CMAKE docs themselves. For each command, module, variable, etc. 
it's documentation could state the version it was added. Some may 
warrant further info for version(s) where significant changes were 
made (eg keywords added to a command). Realistically, it would have to 
be done progressively and obviously with agreement from the Kitware 
side. It would only work if it became part of the change process 
whereby any new features or changes must include such version details. 
It would be interesting to hear what Kitware think of the idea. Any 
chance?


I've also made use of such information from time to time but I think it 
has been the exception and it doesn't normally come up during my regular 
development workflow.


I assume for most projects there is a single 
cmake_minimum_required(VERSION).
Which means to see what is and what isn't available I only have to check 
that specific version's documentation.


I am curious as to what kind of use case results in having to require 
cross-version information as provided by the compatibility matrix "a lot".


Nils
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] Version compatibility?

2016-04-25 Thread Vladimír Vondruš
In my case I'm going through changelogs to see what is added in which version. 
For example I switched to the imported target workflow recently and need to 
keep backward compatibility all the way back to 2.8.12 (because Ubuntu LTS). 
There are a lot of features that were added later and are crucial (ALIAS 
targets, interface compatibility...), so I somehow need to add version-specific 
workarounds to make the projects working on 2.8.12.

The changelogs are pretty useful source of information, but it would be great 
to have the information directly in the docs to avoid trial and error.

Regards
mosra

__
> Od: Nils Gladitz 
> Komu: Craig Scott , "Johannes Zarl-Zierl" 
> 
> Datum: 25.04.2016 15:51
> Předmět: Re: [CMake] Version compatibility?
>
> CC: "cmake@cmake.org" 
>On 04/25/2016 02:29 PM, Craig Scott wrote:
>> I personally have found myself having to look up to his sort of 
>> version info a lot lately. It sounds like others do too. Perhaps a 
>> more sustainable approach would be to include the version details in 
>> the CMAKE docs themselves. For each command, module, variable, etc. 
>> it's documentation could state the version it was added. Some may 
>> warrant further info for version(s) where significant changes were 
>> made (eg keywords added to a command). Realistically, it would have to 
>> be done progressively and obviously with agreement from the Kitware 
>> side. It would only work if it became part of the change process 
>> whereby any new features or changes must include such version details. 
>> It would be interesting to hear what Kitware think of the idea. Any 
>> chance?
>
>I've also made use of such information from time to time but I think it 
>has been the exception and it doesn't normally come up during my regular 
>development workflow.
>
>I assume for most projects there is a single 
>cmake_minimum_required(VERSION).
>Which means to see what is and what isn't available I only have to check 
>that specific version's documentation.
>
>I am curious as to what kind of use case results in having to require 
>cross-version information as provided by the compatibility matrix "a lot".
>
>Nils
>
>
>--
>
>-- 
>
>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:
>http://public.kitware.com/mailman/listinfo/cmake
>
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] adding parts of build log to dashboard.

2016-04-25 Thread Rashad Kanavath
could we inject some files inside Build.xml ?

On Thu, Jan 7, 2016 at 5:21 PM, Clinton Stimpson 
wrote:

> On Thursday, January 07, 2016 02:51:18 PM Rashad Kanavath wrote:
> > Hello,
> >
> > How can I include part of my build log to cdash output. Currently cdash
> > pickup build errors and warnings.
> >
> > In the build summary, if there is no build log attached. I think this is
> > intentional given the size of build log for some projects.
> >
> > What I would like to know is , if there is way I can put some logs into
> > build summary page via some special cmake settings. I don't may be
> setting
> > a cmake var ?
> >
> > My situation is I have a set of add_custom_targets that I used to make
> > packages. they produce various ouputs such as processing abc.dll,
> creating
> > zip archive, adding files to archive etc..
> >
> > Is there a way I can include them into the build summary ?
>
> I don't know how to add them to the build summary.
>
> What I do for packages is make a test for them, using add_test().
> There are settings to control how much test output you get on cdash.
>
> Clint
>



-- 
Regards,
   Rashad
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

Re: [CMake] Finding 32bit libs on 64bit Ubuntu install

2016-04-25 Thread Nick Deubert
On Fri, Apr 22, 2016 at 5:08 PM, Alan W. Irwin
 wrote:
> On 2016-04-22 14:59-0400 Nick Deubert wrote:
>
>> Hey everyone, I am trying to build and link some 32bit binaries on
>> Ubuntu 15.10 64bit, but no matter what combination of arguments I give
>> FIND_LIBRARY I cannot get it to use the 32bit libs. I have been
>> scouring the mailing lists and came up with all these things to try
>> but nothing has worked so far. I am using cmake 3.0.2. Please let me
>> know what I am missing. Thanks in advance for your help.
>
>
> CMake 3.0.2 is pretty old, and there were some find and other issues
> for early CMake-3 versions.  I don't know whether any of those issues
> are relevant to the issue you are discussing. Nevertheless, as an
> experiment (and to make sure your eventual solution works for the
> latest CMake) I would suggest you try building and using the latest
> released version of CMake, 3.5.2, to see if that makes any difference.
>
> Alan

Ok I upgraded to 3.2.2 which is the latest ubuntu 15.10 offers (I will
try 16.04 w/3.5.1 soon), but I get the same issue. Is my syntax all
correct as far as you can tell?
Thanks,
Nick
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake


Re: [CMake] Finding 32bit libs on 64bit Ubuntu install

2016-04-25 Thread Nils Gladitz

On 22.04.2016 20:59, Nick Deubert wrote:

Hey everyone, I am trying to build and link some 32bit binaries on
Ubuntu 15.10 64bit, but no matter what combination of arguments I give
FIND_LIBRARY I cannot get it to use the 32bit libs. I have been
scouring the mailing lists and came up with all these things to try
but nothing has worked so far. I am using cmake 3.0.2. Please let me
know what I am missing. Thanks in advance for your help.
Nick


Run cmake e.g. like this:
CC="gcc -m32" CXX="g++ -m32" cmake ..

Don't try to add -m32 within the project.
This way the try_compile() tests that cmake runs will correctly 
determine that you are building 32-bit and find_library() will use the 
correct paths.


Make sure you start with a fresh build directory.

Nils
--

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:
http://public.kitware.com/mailman/listinfo/cmake


Re: [CMake] Finding 32bit libs on 64bit Ubuntu install

2016-04-25 Thread Alan W. Irwin

On 2016-04-25 14:06-0400 Nick Deubert wrote:


On Fri, Apr 22, 2016 at 5:08 PM, Alan W. Irwin
 wrote:

On 2016-04-22 14:59-0400 Nick Deubert wrote:


Hey everyone, I am trying to build and link some 32bit binaries on
Ubuntu 15.10 64bit, but no matter what combination of arguments I give
FIND_LIBRARY I cannot get it to use the 32bit libs. I have been
scouring the mailing lists and came up with all these things to try
but nothing has worked so far. I am using cmake 3.0.2. Please let me
know what I am missing. Thanks in advance for your help.



CMake 3.0.2 is pretty old, and there were some find and other issues
for early CMake-3 versions.  I don't know whether any of those issues
are relevant to the issue you are discussing. Nevertheless, as an
experiment (and to make sure your eventual solution works for the
latest CMake) I would suggest you try building and using the latest
released version of CMake, 3.5.2, to see if that makes any difference.

Alan


Ok I upgraded to 3.2.2 which is the latest ubuntu 15.10 offers (I will
try 16.04 w/3.5.1 soon), but I get the same issue.



Is my syntax all correct as far as you can tell?


Hi Nick:

The syntax is OK _as far as I can tell_, but I did notice one important
issue in the libdl information you supplied with your original post which is
your 64-bit version of libdl is

-- DL_LIBRARY is /usr/lib/x86_64-linux-gnu/libdl.so

but there is no libdl.so in your 32-bit directory listings.  The closest
you come is

/lib/i386-linux-gnu/libdl.so.2 -> libdl-2.21.so

but that doesn't cut it, and you need a development symlink (provided
by the development version of a library package) that defines a 32-bit
libdl.so symlink that can be found by CMake. Such symlink would
ordinarily be supplied by a Ubuntu development package.  I don't have
Ubuntu installed myself, but Ubuntu is based on Debian, and for Debian
jessie the package name is libc6-dev-i386, and it contains the

/usr/lib32/libdl.so

symlink.  So look for a similarly named package for Ubuntu, verify it contains
libdl.so  (I did that on Debian using "apt-file search libdl.so") and install 
it.

I haven't looked at the other 32-bit libraries you are trying to
find, but I assume there are similar "did not install development
version of package" issues for those as well.

If installing the correct development versions of the 32-bit libraries
does not completely solve your issue, then my advice is

1. When faced with a CMake issue build and install the latest CMake
(don't wait for Ubuntu to package it up)
to help you illustrate the problem.  Building the latest version of
CMake is straightforward.  You can use an older version of cmake to
do that or else use the bootstrap script (mentioned at
 to build on Unix platforms that don't
have any cmake version available.

2. make a really simple test project to illustrate the problem, e.g.,

cmake_minimum_required(VERSION 3.5.2 FATAL_ERROR)
project(test C)
find_library(DL_LIBRARY dl)
message(STATUS DL_LIBRARY = ${DL_LIBRARY})

I tried that project here (with minimum 3.4.3 since that is the latest
version of CMake I happen to have built here [with the bootstrap
script by the way]) with the following (good) results:
-- The C compiler identification is GNU 4.9.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- DL_LIBRARY=/usr/lib/x86_64-linux-gnu/libdl.so
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/test_cmake/build_dir

I assume you would get similarly good results with this simple project
in the 32-bit case once you have installed the relevant development
packages for your 32-bit libraries, but you should check that.

Alan
__
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__

Linux-powered Science
__
--

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/open

Re: [CMake] Finding 32bit libs on 64bit Ubuntu install

2016-04-25 Thread Nick Deubert
On Mon, Apr 25, 2016 at 4:01 PM, Alan W. Irwin
 wrote:
> On 2016-04-25 14:06-0400 Nick Deubert wrote:
>
>> On Fri, Apr 22, 2016 at 5:08 PM, Alan W. Irwin
>>  wrote:
>>>
>>> On 2016-04-22 14:59-0400 Nick Deubert wrote:
>>>
 Hey everyone, I am trying to build and link some 32bit binaries on
 Ubuntu 15.10 64bit, but no matter what combination of arguments I give
 FIND_LIBRARY I cannot get it to use the 32bit libs. I have been
 scouring the mailing lists and came up with all these things to try
 but nothing has worked so far. I am using cmake 3.0.2. Please let me
 know what I am missing. Thanks in advance for your help.
>>>
>>>
>>>
>>> CMake 3.0.2 is pretty old, and there were some find and other issues
>>> for early CMake-3 versions.  I don't know whether any of those issues
>>> are relevant to the issue you are discussing. Nevertheless, as an
>>> experiment (and to make sure your eventual solution works for the
>>> latest CMake) I would suggest you try building and using the latest
>>> released version of CMake, 3.5.2, to see if that makes any difference.
>>>
>>> Alan
>>
>>
>> Ok I upgraded to 3.2.2 which is the latest ubuntu 15.10 offers (I will
>> try 16.04 w/3.5.1 soon), but I get the same issue.
>
>
>> Is my syntax all correct as far as you can tell?
>
>
> Hi Nick:
>
> The syntax is OK _as far as I can tell_, but I did notice one important
> issue in the libdl information you supplied with your original post which is
> your 64-bit version of libdl is
>
> -- DL_LIBRARY is /usr/lib/x86_64-linux-gnu/libdl.so
>
> but there is no libdl.so in your 32-bit directory listings.  The closest
> you come is
>
> /lib/i386-linux-gnu/libdl.so.2 -> libdl-2.21.so
>
> but that doesn't cut it, and you need a development symlink (provided
> by the development version of a library package) that defines a 32-bit
> libdl.so symlink that can be found by CMake. Such symlink would
> ordinarily be supplied by a Ubuntu development package.  I don't have
> Ubuntu installed myself, but Ubuntu is based on Debian, and for Debian
> jessie the package name is libc6-dev-i386, and it contains the
>
> /usr/lib32/libdl.so
>
> symlink.  So look for a similarly named package for Ubuntu, verify it
> contains
> libdl.so  (I did that on Debian using "apt-file search libdl.so") and
> install it.

Solved! I did have the 32bit-dev libraries installed but your tip made
me realize the plain .so files are installed into
/usr/lib/i386-linux-gnu and not /lib/i386-linux-gnu. As soon as I
switched to that path it is finding all the right libs. I didn't
realize cmake wouldn't parse the version numbers, so that is a very
good thing to know.
Thanks for your help!
Nick
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake


Re: [CMake] Version compatibility?

2016-04-25 Thread Craig Scott
In my case, I work with a large code base that spans many projects with
various interdependencies. Some of that code base is quite old and would
benefit from updating to more modern CMake features, but some parts of the
code I'm not free to update. For these cases, I need to understand what
CMake version a particular feature was introduced before I can start using
it and also to put in place guards so that the updated project can still be
used with older projects that don't want or can't yet move to using a newer
CMake version. In an ideal world, everyone would just move to the latest
current CMake release and our projects could use whatever CMake features
they like, but that's not the reality we live in, for various reasons. ;)

On a personal level, I also write a blog which frequently covers CMake
features. I find I am always having to go check what version a particular
CMake feature was introduced so that I can highlight to my readers what
minimum CMake version they need to set. Like Vladimir, this usually
requires me to go through release notes or older versions of the CMake docs
to work out when that particular command, variable, module, etc. was added.
It would be great if the latest version's documentation always had that
information instead, it would be more reliable and certainly more
convenient.


On Mon, Apr 25, 2016 at 11:48 PM, Nils Gladitz 
wrote:

> On 04/25/2016 02:29 PM, Craig Scott wrote:
>
> I personally have found myself having to look up to his sort of version
> info a lot lately. It sounds like others do too. Perhaps a more
> sustainable approach would be to include the version details in the CMAKE
> docs themselves. For each command, module, variable, etc. it's
> documentation could state the version it was added. Some may warrant
> further info for version(s) where significant changes were made (eg
> keywords added to a command). Realistically, it would have to be done
> progressively and obviously with agreement from the Kitware side. It would
> only work if it became part of the change process whereby any new features
> or changes must include such version details. It would be interesting to
> hear what Kitware think of the idea. Any chance?
>
>
> I've also made use of such information from time to time but I think it
> has been the exception and it doesn't normally come up during my regular
> development workflow.
>
> I assume for most projects there is a single
> cmake_minimum_required(VERSION).
> Which means to see what is and what isn't available I only have to check
> that specific version's documentation.
>
> I am curious as to what kind of use case results in having to require
> cross-version information as provided by the compatibility matrix "a lot".
>
> Nils
>



-- 
Craig Scott
Melbourne, Australia
http://crascit.com
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

[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:
①test_dir/CMakeLists.txt:
PROJECT(TESTLIB)
add_subdirectory(sub_hello sub_hello)
add_subdirectory(top top) 

②test_dir/sub_hello/CMakeLists.txt:
message("message from sub_hello")
add_library(hello_lib  SHARED hello.c)

③test_dir/top/CMakeLists.txt:
include_directories(../sub_hello)
add_executable(main main.c)
target_link_libraries(main hello_lib)

④test_dir/sub_hello/hello.c:
#include 
void HelloFunc()
{
printf("###hello###\n");
}

⑤test_dir/top/main.c:
int main()
{
HelloFunc();
return 0;
}

After i cmake this project, generated .sln and .proj files, then i built it
and i get an error in vs: 

Error   LNK1104 can't open file "..\sub_hello\Debug\hello_lib.lib"

In folder ..\sub_hello\Debug\ , there was not a hello_lib.lib existed.
Then i look thorough and found a solution: 

Add "set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES)" in file
test_dir/sub_hello/hello.c  

Then i built this solution again, this time it success, and hello_lib.lib
and main.exe was generated. But when i try to run main.exe, an error 
occured: "lose hello_lib.dll". And i moved hello_lib.dll into the folder of
main.exe, and it worked well.

There are two questions i could not figure out:
①Is this "..\sub_hello\Debug\hello_lib.lib" associates with
"..\sub_hello\Debug\hello_lib.dll"? For windows can not use .dll directly,
and use a .lib to record the .dll's  entrance and location.
②How to solve the problem of main.exe can not find .dll file.

Best regards,
Chao Zhang





--
View this message in context: 
http://cmake.3232098.n2.nabble.com/How-to-link-shared-lib-on-windows-visual-studio-2014-tp7593346.html
Sent from the CMake mailing list archive at Nabble.com.
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

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

2016-04-25 Thread Chaos Zhang


Jakob van Bethlehem wrote
> Hej,
> 
> You really should provide more detailed information about your project
> structure, and what is going wrong. There are some subtle differences
> between Linux/Windows, but not at the level you're referring to. Certainly
> the IMPORTED property has nothing to do with a platform distinction.
> IMPORTED libraries work exactly the same on Windows/Linux.
> 
> There is a very big difference between Linux/Windows though in the sense
> that on Windows you need to explicitly export symbols you want to be
> available on the interface of the dll. My first guess from your very
> limited info is that something is wrong in that area (and if that's the
> case, you can easily resolve this using the GenerateExportHeader module).
> 
> But back to my original comment: provide more details on what you are
> trying to 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 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
>> give
>> me one or some? BTW the dll lib seem could be used in Mingw makefile on
>> windows.
>>
>> Thanks,
>> Chao Zhang
>>
>>
>>
>> --
>> View this message in context:
>> http://cmake.3232098.n2.nabble.com/Need-a-example-to-use-dll-in-vs-tp7593331.html
>> Sent from the CMake mailing list archive at Nabble.com.
>> --
>>
>> 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:
>> http://public.kitware.com/mailman/listinfo/cmake
>>
> 
> -- 
> 
> Powered by www.kitware.com
> Thanks for your advice, i have add a new topic named "How to link shared
> lib on windows (visual studio 2014)", sincerely look forward to your
> reply. ^_^ 
> 
> Chao
> 
> 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:
> http://public.kitware.com/mailman/listinfo/cmake





--
View this message in context: 
http://cmake.3232098.n2.nabble.com/Need-a-example-to-use-dll-in-vs-tp7593331p7593347.html
Sent from the CMake mailing list archive at Nabble.com.
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake


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/
>CMakeLists.txt
>hello.c
>  -top/
>main.c
>CMakeLists.txt
>  CMakeLists.txt
>
> The content of each file:
> ①test_dir/CMakeLists.txt:
> PROJECT(TESTLIB)
> add_subdirectory(sub_hello sub_hello)
> add_subdirectory(top top)
>
> ②test_dir/sub_hello/CMakeLists.txt:
> message("message from sub_hello")
> add_library(hello_lib  SHARED hello.c)
>
> ③test_dir/top/CMakeLists.txt:
> include_directories(../sub_hello)
> add_executable(main main.c)
> target_link_libraries(main hello_lib)
>
> ④test_dir/sub_hello/hello.c:
> #include 
> void HelloFunc()
> {
> printf("###hello###\n");
> }
>
> ⑤test_dir/top/main.c:
> int main()
> {
> HelloFunc();
> return 0;
> }
>
> After i cmake this project, generated .sln and .proj files, then i built it
> and i get an error in vs:
>
> Error   LNK1104 can't open file "..\sub_hello\Debug\hello_lib.lib"
>
> In folder ..\sub_hello\Debug\ , there was not a hello_lib.lib existed.
> Then i look thorough and found a solution:
>
> Add "set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES)" in file
> test_dir/sub_hello/hello.c
>
> Then i built this solution again, this time it success, and hello_lib.lib
> and main.exe was generated. But when i try to run main.exe, an error
> occured: "lose hello_lib.dll". And i moved hello_lib.dll into the folder of
> main.exe, and it worked well.
>
> There are two questions i could not figure out:
> ①Is this "..\sub_hello\Debug\hello_lib.lib" associates with
> "..\sub_hello\Debug\hello_lib.dll"? For windows can not use .dll directly,
> and use a .lib to record the .dll's  entrance and location.
> ②How to solve the problem of main.exe can not find .dll file.
>
> Best regards,
> Chao Zhang
>
>
>
>
>
> --
> View this message in context:
> http://cmake.3232098.n2.nabble.com/How-to-link-shared-lib-on-windows-visual-studio-2014-tp7593346.html
> Sent from the CMake mailing list archive at Nabble.com.
> --
>
> 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:
> http://public.kitware.com/mailman/listinfo/cmake
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

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 HelloFunc();

That way when you are building a shared lib on windows it will export those
symbols which in turn creates the .lib. Without the exported symbols, you
will not have an import lib.

(2)

The missing DLL is a pain that you are just going to have to deal with
unless you want to do a bunch of voodoo with the registry or copy the DLLs.
Typically, there are POST_BUILD steps that copy the needed DLLs into the
same directory as the exe. There are many stackoverflow questions dealing
with this, first one googled here:

http://stackoverflow.com/questions/5765986/how-can-i-run-an-exe-with-dlls-in-separate-directory

-Caleb


On Mon, Apr 25, 2016 at 9: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/
>CMakeLists.txt
>hello.c
>  -top/
>main.c
>CMakeLists.txt
>  CMakeLists.txt
>
> The content of each file:
> ①test_dir/CMakeLists.txt:
> PROJECT(TESTLIB)
> add_subdirectory(sub_hello sub_hello)
> add_subdirectory(top top)
>
> ②test_dir/sub_hello/CMakeLists.txt:
> message("message from sub_hello")
> add_library(hello_lib  SHARED hello.c)
>
> ③test_dir/top/CMakeLists.txt:
> include_directories(../sub_hello)
> add_executable(main main.c)
> target_link_libraries(main hello_lib)
>
> ④test_dir/sub_hello/hello.c:
> #include 
> void HelloFunc()
> {
> printf("###hello###\n");
> }
>
> ⑤test_dir/top/main.c:
> int main()
> {
> HelloFunc();
> return 0;
> }
>
> After i cmake this project, generated .sln and .proj files, then i built it
> and i get an error in vs:
>
> Error   LNK1104 can't open file "..\sub_hello\Debug\hello_lib.lib"
>
> In folder ..\sub_hello\Debug\ , there was not a hello_lib.lib existed.
> Then i look thorough and found a solution:
>
> Add "set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES)" in file
> test_dir/sub_hello/hello.c
>
> Then i built this solution again, this time it success, and hello_lib.lib
> and main.exe was generated. But when i try to run main.exe, an error
> occured: "lose hello_lib.dll". And i moved hello_lib.dll into the folder of
> main.exe, and it worked well.
>
> There are two questions i could not figure out:
> ①Is this "..\sub_hello\Debug\hello_lib.lib" associates with
> "..\sub_hello\Debug\hello_lib.dll"? For windows can not use .dll directly,
> and use a .lib to record the .dll's  entrance and location.
> ②How to solve the problem of main.exe can not find .dll file.
>
> Best regards,
> Chao Zhang
>
>
>
>
>
> --
> View this message in context:
> http://cmake.3232098.n2.nabble.com/How-to-link-shared-lib-on-windows-visual-studio-2014-tp7593346.html
> Sent from the CMake mailing list archive at Nabble.com.
> --
>
> 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:
> http://public.kitware.com/mailman/listinfo/cmake




-- 
J. Caleb Wherry
*Scientific Software Engineer*


http://www.calebwherry.com
+1 (615) 708-5651
calebwhe...@gmail.com
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

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 11:33 AM, J Decker  wrote:

> 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/
>>CMakeLists.txt
>>hello.c
>>  -top/
>>main.c
>>CMakeLists.txt
>>  CMakeLists.txt
>>
>> The content of each file:
>> ①test_dir/CMakeLists.txt:
>> PROJECT(TESTLIB)
>> add_subdirectory(sub_hello sub_hello)
>> add_subdirectory(top top)
>>
>> ②test_dir/sub_hello/CMakeLists.txt:
>> message("message from sub_hello")
>> add_library(hello_lib  SHARED hello.c)
>>
>> ③test_dir/top/CMakeLists.txt:
>> include_directories(../sub_hello)
>> add_executable(main main.c)
>> target_link_libraries(main hello_lib)
>>
>> ④test_dir/sub_hello/hello.c:
>> #include 
>> void HelloFunc()
>> {
>> printf("###hello###\n");
>> }
>>
>> ⑤test_dir/top/main.c:
>> int main()
>> {
>> HelloFunc();
>> return 0;
>> }
>>
>> After i cmake this project, generated .sln and .proj files, then i built
>> it
>> and i get an error in vs:
>>
>> Error   LNK1104 can't open file "..\sub_hello\Debug\hello_lib.lib"
>>
>> In folder ..\sub_hello\Debug\ , there was not a hello_lib.lib existed.
>> Then i look thorough and found a solution:
>>
>> Add "set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES)" in file
>> test_dir/sub_hello/hello.c
>>
>> Then i built this solution again, this time it success, and hello_lib.lib
>> and main.exe was generated. But when i try to run main.exe, an error
>> occured: "lose hello_lib.dll". And i moved hello_lib.dll into the folder
>> of
>> main.exe, and it worked well.
>>
>> There are two questions i could not figure out:
>> ①Is this "..\sub_hello\Debug\hello_lib.lib" associates with
>> "..\sub_hello\Debug\hello_lib.dll"? For windows can not use .dll directly,
>> and use a .lib to record the .dll's  entrance and location.
>> ②How to solve the problem of main.exe can not find .dll file.
>>
>> Best regards,
>> Chao Zhang
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://cmake.3232098.n2.nabble.com/How-to-link-shared-lib-on-windows-visual-studio-2014-tp7593346.html
>> Sent from the CMake mailing list archive at Nabble.com.
>> --
>>
>> 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:
>> http://public.kitware.com/mailman/listinfo/cmake
>
>
> --
>
> 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:
> http://public.kitware.com/mailman/listinfo/cmake
>



-- 
Craig Scott
Melbourne, Australia
http://crascit.com
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake

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 PUBLIC_API __declspec(dllexport)
> #else
> #define PUBLIC_API
> #endif
>
> PUBLIC_API void HelloFunc();
>
> That way when you are building a shared lib on windows it will export
those symbols which in turn creates the .lib. Without the exported symbols,
you will not have an import lib.
>
> (2)
>
> The missing DLL is a pain that you are just going to have to deal with
unless you want to do a bunch of voodoo with the registry or copy the DLLs.
Typically, there are POST_BUILD steps that copy the needed DLLs into the
same directory as the exe. There are many stackoverflow questions dealing
with this, first one googled here:
>

Could just set the path environment variable... No registry hack.. Or
include install rules and just build install before running.
>
http://stackoverflow.com/questions/5765986/how-can-i-run-an-exe-with-dlls-in-separate-directory
>
> -Caleb
>
>
> On Mon, Apr 25, 2016 at 9: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/
>>CMakeLists.txt
>>hello.c
>>  -top/
>>main.c
>>CMakeLists.txt
>>  CMakeLists.txt
>>
>> The content of each file:
>> ①test_dir/CMakeLists.txt:
>> PROJECT(TESTLIB)
>> add_subdirectory(sub_hello sub_hello)
>> add_subdirectory(top top)
>>
>> ②test_dir/sub_hello/CMakeLists.txt:
>> message("message from sub_hello")
>> add_library(hello_lib  SHARED hello.c)
>>
>> ③test_dir/top/CMakeLists.txt:
>> include_directories(../sub_hello)
>> add_executable(main main.c)
>> target_link_libraries(main hello_lib)
>>
>> ④test_dir/sub_hello/hello.c:
>> #include 
>> void HelloFunc()
>> {
>> printf("###hello###\n");
>> }
>>
>> ⑤test_dir/top/main.c:
>> int main()
>> {
>> HelloFunc();
>> return 0;
>> }
>>
>> After i cmake this project, generated .sln and .proj files, then i built
it
>> and i get an error in vs:
>>
>> Error   LNK1104 can't open file "..\sub_hello\Debug\hello_lib.lib"
>>
>> In folder ..\sub_hello\Debug\ , there was not a hello_lib.lib existed.
>> Then i look thorough and found a solution:
>>
>> Add "set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES)" in file
>> test_dir/sub_hello/hello.c
>>
>> Then i built this solution again, this time it success, and hello_lib.lib
>> and main.exe was generated. But when i try to run main.exe, an error
>> occured: "lose hello_lib.dll". And i moved hello_lib.dll into the folder
of
>> main.exe, and it worked well.
>>
>> There are two questions i could not figure out:
>> ①Is this "..\sub_hello\Debug\hello_lib.lib" associates with
>> "..\sub_hello\Debug\hello_lib.dll"? For windows can not use .dll
directly,
>> and use a .lib to record the .dll's  entrance and location.
>> ②How to solve the problem of main.exe can not find .dll file.
>>
>> Best regards,
>> Chao Zhang
>>
>>
>>
>>
>>
>> --
>> View this message in context:
http://cmake.3232098.n2.nabble.com/How-to-link-shared-lib-on-windows-visual-studio-2014-tp7593346.html
>> Sent from the CMake mailing list archive at Nabble.com.
>> --
>>
>> 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:
>> http://public.kitware.com/mailman/listinfo/cmake
>
>
>
>
> --
> J. Caleb Wherry
> Scientific Software Engineer
>
> http://www.calebwherry.com
> +1 (615) 708-5651
> calebwhe...@gmail.com
>
> --
>
> 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:
> http://public.kitware.com/mailman/listinfo/cmake
-- 

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 comm

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 building from VS so being able to press F5 and
everything just work is nice. Adding a POST_BULLD step that copies the DLL
to the build location of the exe is the best way to solve the problem.

Lastly, adding an install step just muddles what "install" means, IMO. You
aren't really installing anything, you are just building a project and you
want it to run after building. Installing brings a lot more baggage and
using it here seems like a bad idea.

-Caleb

On Monday, April 25, 2016, J Decker  wrote:

>
> 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 PUBLIC_API __declspec(dllexport)
> > #else
> > #define PUBLIC_API
> > #endif
> >
> > PUBLIC_API void HelloFunc();
> >
> > That way when you are building a shared lib on windows it will export
> those symbols which in turn creates the .lib. Without the exported symbols,
> you will not have an import lib.
> >
> > (2)
> >
> > The missing DLL is a pain that you are just going to have to deal with
> unless you want to do a bunch of voodoo with the registry or copy the DLLs.
> Typically, there are POST_BUILD steps that copy the needed DLLs into the
> same directory as the exe. There are many stackoverflow questions dealing
> with this, first one googled here:
> >
>
> Could just set the path environment variable... No registry hack.. Or
> include install rules and just build install before running.
> >
> http://stackoverflow.com/questions/5765986/how-can-i-run-an-exe-with-dlls-in-separate-directory
> >
> > -Caleb
> >
> >
> > On Mon, Apr 25, 2016 at 9: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/
> >>CMakeLists.txt
> >>hello.c
> >>  -top/
> >>main.c
> >>CMakeLists.txt
> >>  CMakeLists.txt
> >>
> >> The content of each file:
> >> ①test_dir/CMakeLists.txt:
> >> PROJECT(TESTLIB)
> >> add_subdirectory(sub_hello sub_hello)
> >> add_subdirectory(top top)
> >>
> >> ②test_dir/sub_hello/CMakeLists.txt:
> >> message("message from sub_hello")
> >> add_library(hello_lib  SHARED hello.c)
> >>
> >> ③test_dir/top/CMakeLists.txt:
> >> include_directories(../sub_hello)
> >> add_executable(main main.c)
> >> target_link_libraries(main hello_lib)
> >>
> >> ④test_dir/sub_hello/hello.c:
> >> #include 
> >> void HelloFunc()
> >> {
> >> printf("###hello###\n");
> >> }
> >>
> >> ⑤test_dir/top/main.c:
> >> int main()
> >> {
> >> HelloFunc();
> >> return 0;
> >> }
> >>
> >> After i cmake this project, generated .sln and .proj files, then i
> built it
> >> and i get an error in vs:
> >>
> >> Error   LNK1104 can't open file "..\sub_hello\Debug\hello_lib.lib"
> >>
> >> In folder ..\sub_hello\Debug\ , there was not a hello_lib.lib existed.
> >> Then i look thorough and found a solution:
> >>
> >> Add "set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES)" in file
> >> test_dir/sub_hello/hello.c
> >>
> >> Then i built this solution again, this time it success, and
> hello_lib.lib
> >> and main.exe was generated. But when i try to run main.exe, an error
> >> occured: "lose hello_lib.dll". And i moved hello_lib.dll into the
> folder of
> >> main.exe, and it worked well.
> >>
> >> There are two questions i could not figure out:
> >> ①Is this "..\sub_hello\Debug\hello_lib.lib" associates with
> >> "..\sub_hello\Debug\hello_lib.dll"? For windows can not use .dll
> directly,
> >> and use a .lib to record the .dll's  entrance and location.
> >> ②How to solve the problem of main.exe can not find .dll file.
> >>
> >> Best regards,
> >> Chao Zhang
> >>
> >>
> >>
> >>
> >>
> >> --
> >> View this message in context:
> http://cmake.3232098.n2.nabble.com/How-to-link-shared-lib-on-windows-visual-studio-2014-tp7593346.html
> >> Sent from the CMake mailing list archive at Nabble.com.
> >> --
> >>
> >> 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/openso

[CMake] Compiling configuration set for vs project

2016-04-25 Thread vakano
Hi,

I am generating a vcproj and sln project for windows VS2015, do I need to
set each compiling 

configuration in cmakelist? I am doing nothing special for this in current
cmakelist, but the generated

vcproj looks like already contain with compiling info eg:Debug x64, Release
x64, MinSizeRel x64,

RelWithDebInfo x64.

Above config info should be generated automatically by cmake, no need to set
in cmakelist manually

right?

Thanks,
Le



--
View this message in context: 
http://cmake.3232098.n2.nabble.com/Compiling-configuration-set-for-vs-project-tp7593353.html
Sent from the CMake mailing list archive at Nabble.com.
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake


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]) and provides a simple example of
how to write/structure CMake for cross-platform C/C++ projects. You can
ignore the python wrapper if you want, it just makes working with the CMake
exe and system builds easier (calculates core counts, creates directories
for build, nicer 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

If you really are looking to get a one-off project working, Decker's
recommendation about PATH modification is easiest. It's just not something
I think is viable in the long 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  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/
>CMakeLists.txt
>hello.c
>  -top/
>main.c
>CMakeLists.txt
>  CMakeLists.txt
>
> The content of each file:
> ①test_dir/CMakeLists.txt:
> PROJECT(TESTLIB)
> add_subdirectory(sub_hello sub_hello)
> add_subdirectory(top top)
>
> ②test_dir/sub_hello/CMakeLists.txt:
> message("message from sub_hello")
> add_library(hello_lib  SHARED hello.c)
>
> ③test_dir/top/CMakeLists.txt:
> include_directories(../sub_hello)
> add_executable(main main.c)
> target_link_libraries(main hello_lib)
>
> ④test_dir/sub_hello/hello.c:
> #include 
> void HelloFunc()
> {
> printf("###hello###\n");
> }
>
> ⑤test_dir/top/main.c:
> int main()
> {
> HelloFunc();
> return 0;
> }
>
> After i cmake this project, generated .sln and .proj files, then i built it
> and i get an error in vs:
>
> Error   LNK1104 can't open file "..\sub_hello\Debug\hello_lib.lib"
>
> In folder ..\sub_hello\Debug\ , there was not a hello_lib.lib existed.
> Then i look thorough and found a solution:
>
> Add "set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS YES)" in file
> test_dir/sub_hello/hello.c
>
> Then i built this solution again, this time it success, and hello_lib.lib
> and main.exe was generated. But when i try to run main.exe, an error
> occured: "lose hello_lib.dll". And i moved hello_lib.dll into the folder of
> main.exe, and it worked well.
>
> There are two questions i could not figure out:
> ①Is this "..\sub_hello\Debug\hello_lib.lib" associates with
> "..\sub_hello\Debug\hello_lib.dll"? For windows can not use .dll directly,
> and use a .lib to record the .dll's  entrance and location.
> ②How to solve the problem of main.exe can not find .dll file.
>
> Best regards,
> Chao Zhang
>
>
>
>
>
> --
> View this message in context:
> http://cmake.3232098.n2.nabble.com/How-to-link-shared-lib-on-windows-visual-studio-2014-tp7593346.html
> Sent from the CMake mailing list archive at Nabble.com.
> --
>
> 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:
> http://public.kitware.com/mailman/listinfo/cmake




-- 
J. Caleb Wherry
*Scientific Software Engineer*


http://www.calebwherry.com
+1 (615) 708-5651
calebwhe...@gmail.com
-- 

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:
http://public.kitware.com/mailman/listinfo/cmake