[Cmake] central directory for libraries (was: Issues and new ideas )

Sebastien BARRE sebastien at barre.nom.fr
Tue May 22 12:05:44 EDT 2001


Hi

At 12/05/2001 02:15, Sebastien BARRE wrote:

>>>3. Central directory for libraries.   I think this should be
>>>done much like 1. We should create a variable that is used by the 
>>>generators,
>>>LIBRARY_OUTPUT_DIRECTORY, it can be either global or local to a makefile.
>
>Yes, I backup this idea, we need that :), otherwise it's really a pain to 
>add all directories to the PATH.

Ken added some support for that feature (LIBRARY_OUTPUT_PATH, 
EXECUTABLE_OUTPUT_PATH), but bugs were remaining. I guess I fixed most of 
them. Please correct me if I'm wrong :

Sources/cmDSPMakefile.cxx
Templates/staticLibHeader.dsptemplate
Templates/DLLHeader.dsptemplate :

OUTPUT_LIBRARY_PATH was used instead of LIBRARY_OUTPUT_PATH. I guess the 
later term is the good one (anyway, both were mixed, so I had to decide).

Sources/cmDSPMakefile.cxx
Templates/EXEWinHeader.dsptemplate
Templates/EXEHeader.dsptemplate :

same as above, OUTPUT_EXECUTABLE_PATH was used instead of 
EXECUTABLE_OUTPUT_PATH.

Sources/cmDSPMakefile.cxx :

exePath was used instead of libPath for the LIBRARY_OUTPUT_PATH replacement 
in the templates.

Finally, in the new VTK tree : CMakeLists.txt :
         SET (LIBRARY_OUTPUT_PATH "" CACHE)
was replaced by :
         IF (WIN32)
            SET (LIBRARY_OUTPUT_PATH "../Lib/" CACHE)
            SET (EXECUTABLE_OUTPUT_PATH "../Lib/" CACHE)
         ELSE (WIN32)
            SET (LIBRARY_OUTPUT_PATH "" CACHE)
            SET (EXECUTABLE_OUTPUT_PATH "" CACHE)
         ENDIF (WIN32)
to match the old vtk tree (and give some order). Libraries are still stored 
by "release type" in the Lib directory (which looks good to me).

OK, be AWARE that  I noticed that :

         a) you need a trailing backslash at the end of these output path,
         b) it seems to me that the way DSP are built does not allow 
absolute path for the LIBRARY_OUTPUT_PATH or EXECUTABLE_OUTPUT_PATH 
("../Lib" is working OK),
         c) LIBRARY_OUTPUT_PATH and EXECUTABLE_OUTPUT_PATH should be identical,

...for the following reasons :

         a) the templates files expect something like :

# PROP Output_Dir "LIBRARY_OUTPUT_PATHRelease"

         why ? because (as far as I understand it correctly), if 
LIBRARY_OUTPUT_PATH is empty, it defaults to the usual behaviour (i.e. 
output path relative to the current directory). If a trailing bashlash was 
added here (as it should be), it would cause a problem (wouldn'it ?). 
Should be fixed some day ?

         b) you can't use absolute path at the moment, because the *.lib 
file can not be found anymore through the LIBPATH :

# ADD 
LINK32   /LIBPATH:"S:/src/vtk/vtknew-build/Rendering/$(OUTDIR)" 
/LIBPATH:"S:/src/vtk/vtknew-build/Common/$(OUTDIR)"

         as you see, OUTDIR (which I guess is an internal value set by 
MSVC++ from Output_Dir) is expected to be relative to the current (module) 
directory. If you set Output_Dir to an absolute path, the dependencies (and 
export lib) won't be found.

         c) same as above : in the EXE templates, you will notice :
# PROP Output_Dir "EXECUTABLE_OUTPUT_PATHRelease"
         thus, as the LIBPATH settings are the same as above, the binary 
(Mace.cxx in the new tree) won't be linked correctly, because the export 
lib won't be found.

Files have been committed to the CVS. It builds correctly for Windows. 
Problem : I can't change the LIBRARY_OUTPUT_PATH to a different value 
through the GUI :(

Hope this helps





More information about the CMake mailing list