Re: [CMake] Invalid library output directory when VC++ solution is generated

2011-07-29 Thread Michael Hertling
On 07/27/2011 01:03 PM, Laura Autón García wrote:
 Hello glenn,
 Thank you for your answer.
 I misunderstood the documentation. Thank you for pointing this out!
 
 Documentation:
 ...For DLL platforms the DLL part of a shared library is treated as a
 runtime target and the corresponding import library is treated as an
 archive target...
 
 It's a pity, because our intention was to keep in Windows, the way
 this is done in Linux, I mean, libraries (either shared or not) in
 ../lib directory and executables in ../bin directory. Right now, with
 no other ideas than the one provided by Alan in his previous reply,
 there seems to be no simple way to separate DLL files from binaries
 ones. It works perfectly using deprecated options:
 
   SET(EXECUTABLE_OUTPUT_PATH  ${BIN_DIR} CACHE PATH Directory for 
 executables)  
   SET(LIBRARY_OUTPUT_PATH ${LIB_DIR} CACHE PATH 
 Directory for executables)
 
 I understand this is not desirable, so we will have to make a choice
 between using deprecated properties while we try to figure out other
 way, or moving to the new way.

Just a few remarks:

(1) As Glenn has already mentioned, you might set the RUNTIME_OUTPUT_
DIRECTORY target property on your DLL targets to force them being
placed in ../lib - you should prefer absolute paths like ${CMAKE_
BINARY_DIR}/lib here - so you *can* achieve what you intend.

(2) DLLs are placed in the same directories as executables because in
this manner, they're found automatically when the executables are run.
Otherwise, i.e. with DLLs in different directories, you would have to
provide a hint where to search them, e.g. via the path. Regarding the
possibility to run executables from within the build tree - think of
testing - CMake's habit to place DLLs and executables next to each
other is highly reasonable. Note that this is no issue on *nix as
the mechanism for finding shared libraries is usually different.

(3) The MS tools do not refer to the DLL for linking - they refer to
the accompanying import library placed in the archive directory - so
the DLLs do not need to be written to a specific directory to build
executables but may reside wherever it's advantageous. However, the
GNU linker, i.e. MinGW, is able to link against DLLs immediately.

(4) If you want to place the DLLs in a lib directory during the final
installation, just use a separate INSTALL() command for them with a
RUNTIME DESTINATION lib whereas executables have an INSTALL() with
a RUNTIME DESTINATION bin, or do you depend on a certain directory
layout within the build tree?

Regards,

Michael

 2011/7/26 Glenn Coombs glenn.coo...@gmail.com:
 Have a look at the documentation for CMAKE_RUNTIME_OUTPUT_DIRECTORY.  On
 Linux the .so shared library files do go in the LIBRARY_OUTPUT_DIRECTORY.
 However, on Windows the DLL files are placed in the runtime directory and
 only the import libraries (.LIB files) are placed in the
 LIBRARY_OUTPUT_DIRECTORY.

 2011/7/25 Laura Autón García laura.au...@gmail.com

 Hello all,
 In the project I am collaborating on, CMake is used in Windows in
 order to generate a Visual C++ solution to be compiled afterwards. In
 this process, everything seems to work fine as the external
 directories and libraries are well included and everything compiles
 and so. However, we are experiencing problems with the directory in
 which our dll library is to be created.
 We specify in CMake that the directory is ../lib but
 when checking the configuration in Visual C++ software, it seems to be
 ../bin/Release directory, so the library is generated there.
 The CMake sentences we wrote regarding this issue are as follows:

  SET(LIB_DIR  ${PROJECT_SOURCE_DIR}/lib)
  SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB_DIR} CACHE PATH Directory
 for libraries)

 According to the documentation:

  CMAKE_LIBRARY_OUTPUT_DIRECTORY: Where to put all the LIBRARY
 targets when built.
  This variable is used to initialize the LIBRARY_OUTPUT_DIRECTORY
 property on all the targets.
  See that target property for additional information.

 Also, the documentation regarding LIBRARY_OUTPUT_DIRECTORY shows:

  LIBRARY_OUTPUT_DIRECTORY: Output directory in which to build
 LIBRARY target files.
  This property specifies the directory into which library target
 files should be built. There are three
  kinds of target files that may be built: archive, library, and
 runtime. Executables are always treated
  as runtime targets. Static libraries are always treated as archive
 targets. Module libraries are always
  treated as library targets. For non-DLL platforms shared libraries
 are treated as library targets. For
  DLL platforms the DLL part of a shared library is treated as a
 runtime target and the corresponding
  import library is treated as an archive target. All Windows-based
 systems including Cygwin are
  DLL platforms. This property is initialized by the value of the variable
  CMAKE_LIBRARY_OUTPUT_DIRECTORY if it is set when a target is created.

 

Re: [CMake] Invalid library output directory when VC++ solution is generated

2011-07-27 Thread Rolf Eike Beer
 Have a look at the documentation for CMAKE_RUNTIME_OUTPUT_DIRECTORY.  On
 Linux the .so shared library files do go in the LIBRARY_OUTPUT_DIRECTORY.
 However, on Windows the DLL files are placed in the runtime directory and
 only the import libraries (.LIB files) are placed in the
 LIBRARY_OUTPUT_DIRECTORY.

The .lib files got into ARCHIVE_OUTPUT_DIRECTORY.

Eike


___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Invalid library output directory when VC++ solution is generated

2011-07-27 Thread Rolf Eike Beer
 Have a look at the documentation for CMAKE_RUNTIME_OUTPUT_DIRECTORY.  On
 Linux the .so shared library files do go in the LIBRARY_OUTPUT_DIRECTORY.
 However, on Windows the DLL files are placed in the runtime directory and
 only the import libraries (.LIB files) are placed in the
 LIBRARY_OUTPUT_DIRECTORY.

The .lib files got into ARCHIVE_OUTPUT_DIRECTORY.

Eike


___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Invalid library output directory when VC++ solution is generated

2011-07-27 Thread Laura Autón García
Hello glenn,
Thank you for your answer.
I misunderstood the documentation. Thank you for pointing this out!

Documentation:
...For DLL platforms the DLL part of a shared library is treated as a
runtime target and the corresponding import library is treated as an
archive target...

It's a pity, because our intention was to keep in Windows, the way
this is done in Linux, I mean, libraries (either shared or not) in
../lib directory and executables in ../bin directory. Right now, with
no other ideas than the one provided by Alan in his previous reply,
there seems to be no simple way to separate DLL files from binaries
ones. It works perfectly using deprecated options:

SET(EXECUTABLE_OUTPUT_PATH  ${BIN_DIR} CACHE PATH Directory for 
executables)  
SET(LIBRARY_OUTPUT_PATH ${LIB_DIR} CACHE PATH 
Directory for executables)

I understand this is not desirable, so we will have to make a choice
between using deprecated properties while we try to figure out other
way, or moving to the new way.

2011/7/26 Glenn Coombs glenn.coo...@gmail.com:
 Have a look at the documentation for CMAKE_RUNTIME_OUTPUT_DIRECTORY.  On
 Linux the .so shared library files do go in the LIBRARY_OUTPUT_DIRECTORY.
 However, on Windows the DLL files are placed in the runtime directory and
 only the import libraries (.LIB files) are placed in the
 LIBRARY_OUTPUT_DIRECTORY.

 2011/7/25 Laura Autón García laura.au...@gmail.com

 Hello all,
 In the project I am collaborating on, CMake is used in Windows in
 order to generate a Visual C++ solution to be compiled afterwards. In
 this process, everything seems to work fine as the external
 directories and libraries are well included and everything compiles
 and so. However, we are experiencing problems with the directory in
 which our dll library is to be created.
 We specify in CMake that the directory is ../lib but
 when checking the configuration in Visual C++ software, it seems to be
 ../bin/Release directory, so the library is generated there.
 The CMake sentences we wrote regarding this issue are as follows:

  SET(LIB_DIR      ${PROJECT_SOURCE_DIR}/lib)
  SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB_DIR} CACHE PATH Directory
 for libraries)

 According to the documentation:

  CMAKE_LIBRARY_OUTPUT_DIRECTORY: Where to put all the LIBRARY
 targets when built.
  This variable is used to initialize the LIBRARY_OUTPUT_DIRECTORY
 property on all the targets.
  See that target property for additional information.

 Also, the documentation regarding LIBRARY_OUTPUT_DIRECTORY shows:

  LIBRARY_OUTPUT_DIRECTORY: Output directory in which to build
 LIBRARY target files.
  This property specifies the directory into which library target
 files should be built. There are three
  kinds of target files that may be built: archive, library, and
 runtime. Executables are always treated
  as runtime targets. Static libraries are always treated as archive
 targets. Module libraries are always
  treated as library targets. For non-DLL platforms shared libraries
 are treated as library targets. For
  DLL platforms the DLL part of a shared library is treated as a
 runtime target and the corresponding
  import library is treated as an archive target. All Windows-based
 systems including Cygwin are
  DLL platforms. This property is initialized by the value of the variable
  CMAKE_LIBRARY_OUTPUT_DIRECTORY if it is set when a target is created.

 However, when the project is generated, the library output directory
 is not the one specified, but the one I mentioned above.
 If anyone has any idea why this may be happening, it would be appreciated.
 The binaries, on the other hand, as generated in their correct directory.

 Thank you in advance.
 ___
 Powered by www.kitware.com

 Visit other Kitware open-source projects at
 http://www.kitware.com/opensource/opensource.html

 Please keep messages on-topic and check the CMake FAQ at:
 http://www.cmake.org/Wiki/CMake_FAQ

 Follow this link to subscribe/unsubscribe:
 http://www.cmake.org/mailman/listinfo/cmake


___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Invalid library output directory when VC++ solution is generated

2011-07-27 Thread Laura Autón García
Hello Alan,
Thank you very much for your answer.
It woks perfectly using deprecated options, which is kind of funny,
isn't it? As Glenn pointed out in his reply afterwards, newer options
(ARCHIVE_OUTPUT_DIRECTORY, LIBRARY_OUTPUT_DIRECTORY and
RUNTIME_OUTPUT_DIRECTORY) work differently from deprecated ones, as in
Windows, shared libraries are generated in the runtime directory
instead of the library directory. And static libraries are even
generated in the archive output directory instead of library
directory:

Executables are always treated as runtime targets. -- Static
libraries are always treated as archive targets ---. Module libraries
are always treated as library targets. -- For non-DLL platforms
shared libraries are treated as library targets -- (that's why it
works as expected in Linux). -- For DLL platforms the DLL part of a
shared library is treated as a runtime target -- and the
corresponding import library is treated as an archive target. All
Windows-based systems including Cygwin are DLL platforms.

By the way, we build shared libraries after our project solution is
generated. I mean, we first generate with CMake the solution to be
opened in Visual C++ and then we compile the solution in Visual C++.
At the point of compilation, the dll library is generated. So that,
there is no conflict between when we determine where the dll is to be
generated and when is generated.

I am not really experienced with CMake tool, but it seems their
developers had their reasons to determine that dll's have to be
generated in the runtime directory rather than library one. That's not
what we want though. We may accept the changes unless we figure out
other way to do it.

2011/7/25 Alan W. Irwin ir...@beluga.phys.uvic.ca:
 On 2011-07-25 12:19+0100 Laura Autón García wrote:

 Hello all,
 In the project I am collaborating on, CMake is used in Windows in
 order to generate a Visual C++ solution to be compiled afterwards. In
 this process, everything seems to work fine as the external
 directories and libraries are well included and everything compiles
 and so. However, we are experiencing problems with the directory in
 which our dll library is to be created.
 We specify in CMake that the directory is ../lib but
 when checking the configuration in Visual C++ software, it seems to be
 ../bin/Release directory, so the library is generated there.
 The CMake sentences we wrote regarding this issue are as follows:

  SET(LIB_DIR      ${PROJECT_SOURCE_DIR}/lib)
  SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB_DIR} CACHE PATH Directory
 for libraries)

 One possibility is you are setting CMAKE_LIBRARY_OUTPUT_DIRECTORY
 after your dll's are built.

 Just in case that is not the source of the problem, here is
 some further discussion.

 I cannot spot anything wrong with your command above.  However, our
 project (PLplot) hasn't tried that recommended variable yet.  Instead
 we use the deprecated LIBRARY_OUTPUT_PATH variable (mentioned in the
 documentation) like the following (because we are a cross-platform
 project):

 # in windows all created dlls are gathered in the dll directory
 # if you add this directory to your PATH all shared libraries are
 available
 if(BUILD_SHARED_LIBS AND WIN32 AND NOT CYGWIN)
  set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dll)
 endif(BUILD_SHARED_LIBS AND WIN32 AND NOT CYGWIN)

 This works on Windows according to others, and I have also
 personally verified that it works under Wine.

 Although a different variable is used, note the differences with
 how that variable is set with your case.

 (1) The subdirectory is in the build tree rather than the source
 tree.

 (2) We don't cache the variable.

 I don't think any of these differences should matter in terms of
 whether the functionality works or not, but you might want to try them
 with CMAKE_LIBRARY_OUTPUT_DIRECTORY just in case that might be the
 source of your difficulty.  You could also set LIBRARY_OUTPUT_PATH
 like we do as a test, but it would be better to figure out how to get
 CMAKE_LIBRARY_OUTPUT_DIRECTORY to work correctly since our approach is
 deprecated.  (It wasn't deprecated when we started using CMake years
 ago, and we plan to switch over to the recommended method at some point.)

 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); PLplot scientific plotting software
 package (plplot.org); 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

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep 

Re: [CMake] Invalid library output directory when VC++ solution is generated

2011-07-27 Thread Glenn Coombs
You could set the target property RUNTIME_OUTPUT_DIRECTORY on your library
targets.  That would override the CMAKE_RUNTIME_OUTPUT_DIRECTORY variable
just for those targets.

2011/7/27 Laura Autón García laura.au...@gmail.com

 Hello Alan,
 Thank you very much for your answer.
 It woks perfectly using deprecated options, which is kind of funny,
 isn't it? As Glenn pointed out in his reply afterwards, newer options
 (ARCHIVE_OUTPUT_DIRECTORY, LIBRARY_OUTPUT_DIRECTORY and
 RUNTIME_OUTPUT_DIRECTORY) work differently from deprecated ones, as in
 Windows, shared libraries are generated in the runtime directory
 instead of the library directory. And static libraries are even
 generated in the archive output directory instead of library
 directory:

 Executables are always treated as runtime targets. -- Static
 libraries are always treated as archive targets ---. Module libraries
 are always treated as library targets. -- For non-DLL platforms
 shared libraries are treated as library targets -- (that's why it
 works as expected in Linux). -- For DLL platforms the DLL part of a
 shared library is treated as a runtime target -- and the
 corresponding import library is treated as an archive target. All
 Windows-based systems including Cygwin are DLL platforms.

 By the way, we build shared libraries after our project solution is
 generated. I mean, we first generate with CMake the solution to be
 opened in Visual C++ and then we compile the solution in Visual C++.
 At the point of compilation, the dll library is generated. So that,
 there is no conflict between when we determine where the dll is to be
 generated and when is generated.

 I am not really experienced with CMake tool, but it seems their
 developers had their reasons to determine that dll's have to be
 generated in the runtime directory rather than library one. That's not
 what we want though. We may accept the changes unless we figure out
 other way to do it.

 2011/7/25 Alan W. Irwin ir...@beluga.phys.uvic.ca:
  On 2011-07-25 12:19+0100 Laura Autón García wrote:
 
  Hello all,
  In the project I am collaborating on, CMake is used in Windows in
  order to generate a Visual C++ solution to be compiled afterwards. In
  this process, everything seems to work fine as the external
  directories and libraries are well included and everything compiles
  and so. However, we are experiencing problems with the directory in
  which our dll library is to be created.
  We specify in CMake that the directory is ../lib but
  when checking the configuration in Visual C++ software, it seems to be
  ../bin/Release directory, so the library is generated there.
  The CMake sentences we wrote regarding this issue are as follows:
 
   SET(LIB_DIR  ${PROJECT_SOURCE_DIR}/lib)
   SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB_DIR} CACHE PATH Directory
  for libraries)
 
  One possibility is you are setting CMAKE_LIBRARY_OUTPUT_DIRECTORY
  after your dll's are built.
 
  Just in case that is not the source of the problem, here is
  some further discussion.
 
  I cannot spot anything wrong with your command above.  However, our
  project (PLplot) hasn't tried that recommended variable yet.  Instead
  we use the deprecated LIBRARY_OUTPUT_PATH variable (mentioned in the
  documentation) like the following (because we are a cross-platform
  project):
 
  # in windows all created dlls are gathered in the dll directory
  # if you add this directory to your PATH all shared libraries are
  available
  if(BUILD_SHARED_LIBS AND WIN32 AND NOT CYGWIN)
   set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dll)
  endif(BUILD_SHARED_LIBS AND WIN32 AND NOT CYGWIN)
 
  This works on Windows according to others, and I have also
  personally verified that it works under Wine.
 
  Although a different variable is used, note the differences with
  how that variable is set with your case.
 
  (1) The subdirectory is in the build tree rather than the source
  tree.
 
  (2) We don't cache the variable.
 
  I don't think any of these differences should matter in terms of
  whether the functionality works or not, but you might want to try them
  with CMAKE_LIBRARY_OUTPUT_DIRECTORY just in case that might be the
  source of your difficulty.  You could also set LIBRARY_OUTPUT_PATH
  like we do as a test, but it would be better to figure out how to get
  CMAKE_LIBRARY_OUTPUT_DIRECTORY to work correctly since our approach is
  deprecated.  (It wasn't deprecated when we started using CMake years
  ago, and we plan to switch over to the recommended method at some point.)
 
  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); PLplot scientific plotting
 software
  package (plplot.org); the libLASi project (unifont.org/lasi); the Loads
 of
  Linux Links project 

Re: [CMake] Invalid library output directory when VC++ solution is generated

2011-07-27 Thread J Decker
Just as an alternative approach; instead of relying on having the code
in-place, generate appropriate install directives RUNTIME_, ARCHIVE_
and LIBRARY_ issues similar, needing basically a macro
my_install(target) if( WIN32) install( #what's correct for windows )
else( WIN32 ) install ( what's correct for other systems )... but
anyhow, then with a few more lines, you can use cpack to generate
installers.

Now, this means you can't just 'Set Active Project' and click F5 to
run it, but you can right-click on the project, set the debugging
properties of 'Target executable(?)'(first line) (there's a browse if
you click the drop arrow), and then copy the path part of that and
copy-paste to start-in directory(third line).  Then you can run it,
without having to force the solution/project outputs to a specific
place.



2011/7/25 Laura Autón García laura.au...@gmail.com:
 Hello all,
 In the project I am collaborating on, CMake is used in Windows in
 order to generate a Visual C++ solution to be compiled afterwards. In
 this process, everything seems to work fine as the external
 directories and libraries are well included and everything compiles
 and so. However, we are experiencing problems with the directory in
 which our dll library is to be created.
 We specify in CMake that the directory is ../lib but
 when checking the configuration in Visual C++ software, it seems to be
 ../bin/Release directory, so the library is generated there.
 The CMake sentences we wrote regarding this issue are as follows:

  SET(LIB_DIR      ${PROJECT_SOURCE_DIR}/lib)
  SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB_DIR} CACHE PATH Directory
 for libraries)

 According to the documentation:

  CMAKE_LIBRARY_OUTPUT_DIRECTORY: Where to put all the LIBRARY
 targets when built.
  This variable is used to initialize the LIBRARY_OUTPUT_DIRECTORY
 property on all the targets.
  See that target property for additional information.

 Also, the documentation regarding LIBRARY_OUTPUT_DIRECTORY shows:

  LIBRARY_OUTPUT_DIRECTORY: Output directory in which to build
 LIBRARY target files.
  This property specifies the directory into which library target
 files should be built. There are three
  kinds of target files that may be built: archive, library, and
 runtime. Executables are always treated
  as runtime targets. Static libraries are always treated as archive
 targets. Module libraries are always
  treated as library targets. For non-DLL platforms shared libraries
 are treated as library targets. For
  DLL platforms the DLL part of a shared library is treated as a
 runtime target and the corresponding
  import library is treated as an archive target. All Windows-based
 systems including Cygwin are
  DLL platforms. This property is initialized by the value of the variable
  CMAKE_LIBRARY_OUTPUT_DIRECTORY if it is set when a target is created.

 However, when the project is generated, the library output directory
 is not the one specified, but the one I mentioned above.
 If anyone has any idea why this may be happening, it would be appreciated.
 The binaries, on the other hand, as generated in their correct directory.

 Thank you in advance.
 ___
 Powered by www.kitware.com

 Visit other Kitware open-source projects at 
 http://www.kitware.com/opensource/opensource.html

 Please keep messages on-topic and check the CMake FAQ at: 
 http://www.cmake.org/Wiki/CMake_FAQ

 Follow this link to subscribe/unsubscribe:
 http://www.cmake.org/mailman/listinfo/cmake

___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Invalid library output directory when VC++ solution is generated

2011-07-26 Thread Glenn Coombs
Have a look at the documentation for CMAKE_RUNTIME_OUTPUT_DIRECTORY.  On
Linux the .so shared library files do go in the LIBRARY_OUTPUT_DIRECTORY.
However, on Windows the DLL files are placed in the runtime directory and
only the import libraries (.LIB files) are placed in the
LIBRARY_OUTPUT_DIRECTORY.

2011/7/25 Laura Autón García laura.au...@gmail.com

 Hello all,
 In the project I am collaborating on, CMake is used in Windows in
 order to generate a Visual C++ solution to be compiled afterwards. In
 this process, everything seems to work fine as the external
 directories and libraries are well included and everything compiles
 and so. However, we are experiencing problems with the directory in
 which our dll library is to be created.
 We specify in CMake that the directory is ../lib but
 when checking the configuration in Visual C++ software, it seems to be
 ../bin/Release directory, so the library is generated there.
 The CMake sentences we wrote regarding this issue are as follows:

  SET(LIB_DIR  ${PROJECT_SOURCE_DIR}/lib)
  SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB_DIR} CACHE PATH Directory
 for libraries)

 According to the documentation:

  CMAKE_LIBRARY_OUTPUT_DIRECTORY: Where to put all the LIBRARY
 targets when built.
  This variable is used to initialize the LIBRARY_OUTPUT_DIRECTORY
 property on all the targets.
  See that target property for additional information.

 Also, the documentation regarding LIBRARY_OUTPUT_DIRECTORY shows:

  LIBRARY_OUTPUT_DIRECTORY: Output directory in which to build
 LIBRARY target files.
  This property specifies the directory into which library target
 files should be built. There are three
  kinds of target files that may be built: archive, library, and
 runtime. Executables are always treated
  as runtime targets. Static libraries are always treated as archive
 targets. Module libraries are always
  treated as library targets. For non-DLL platforms shared libraries
 are treated as library targets. For
  DLL platforms the DLL part of a shared library is treated as a
 runtime target and the corresponding
  import library is treated as an archive target. All Windows-based
 systems including Cygwin are
  DLL platforms. This property is initialized by the value of the variable
  CMAKE_LIBRARY_OUTPUT_DIRECTORY if it is set when a target is created.

 However, when the project is generated, the library output directory
 is not the one specified, but the one I mentioned above.
 If anyone has any idea why this may be happening, it would be appreciated.
 The binaries, on the other hand, as generated in their correct directory.

 Thank you in advance.
 ___
 Powered by www.kitware.com

 Visit other Kitware open-source projects at
 http://www.kitware.com/opensource/opensource.html

 Please keep messages on-topic and check the CMake FAQ at:
 http://www.cmake.org/Wiki/CMake_FAQ

 Follow this link to subscribe/unsubscribe:
 http://www.cmake.org/mailman/listinfo/cmake

___
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] Invalid library output directory when VC++ solution is generated

2011-07-25 Thread Alan W. Irwin

On 2011-07-25 12:19+0100 Laura Autón García wrote:


Hello all,
In the project I am collaborating on, CMake is used in Windows in
order to generate a Visual C++ solution to be compiled afterwards. In
this process, everything seems to work fine as the external
directories and libraries are well included and everything compiles
and so. However, we are experiencing problems with the directory in
which our dll library is to be created.
We specify in CMake that the directory is ../lib but
when checking the configuration in Visual C++ software, it seems to be
../bin/Release directory, so the library is generated there.
The CMake sentences we wrote regarding this issue are as follows:

 SET(LIB_DIR  ${PROJECT_SOURCE_DIR}/lib)
 SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LIB_DIR} CACHE PATH Directory
for libraries)


One possibility is you are setting CMAKE_LIBRARY_OUTPUT_DIRECTORY
after your dll's are built.

Just in case that is not the source of the problem, here is
some further discussion.

I cannot spot anything wrong with your command above.  However, our
project (PLplot) hasn't tried that recommended variable yet.  Instead
we use the deprecated LIBRARY_OUTPUT_PATH variable (mentioned in the
documentation) like the following (because we are a cross-platform
project):

# in windows all created dlls are gathered in the dll directory
# if you add this directory to your PATH all shared libraries are
available
if(BUILD_SHARED_LIBS AND WIN32 AND NOT CYGWIN)
  set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/dll)
endif(BUILD_SHARED_LIBS AND WIN32 AND NOT CYGWIN)

This works on Windows according to others, and I have also
personally verified that it works under Wine.

Although a different variable is used, note the differences with
how that variable is set with your case.

(1) The subdirectory is in the build tree rather than the source
tree.

(2) We don't cache the variable.

I don't think any of these differences should matter in terms of
whether the functionality works or not, but you might want to try them
with CMAKE_LIBRARY_OUTPUT_DIRECTORY just in case that might be the
source of your difficulty.  You could also set LIBRARY_OUTPUT_PATH
like we do as a test, but it would be better to figure out how to get
CMAKE_LIBRARY_OUTPUT_DIRECTORY to work correctly since our approach is
deprecated.  (It wasn't deprecated when we started using CMake years
ago, and we plan to switch over to the recommended method at some point.)

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); PLplot scientific plotting software
package (plplot.org); 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

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] Invalid library output directory when VC++ solution is generated

2011-07-25 Thread Alan W. Irwin

On 2011-07-25 07:59-0700 Alan W. Irwin wrote:


One possibility is you are setting CMAKE_LIBRARY_OUTPUT_DIRECTORY
after your dll's are built.


That was sloppy language.  What I meant was after your dll targets
are configured by CMake.

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); PLplot scientific plotting software
package (plplot.org); 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

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake