[CMake] LIBRARY_OUTPUT_PATH for Dynamic and Static Libraries

Michael Hertling mhertling at online.de
Fri Jul 29 18:51:03 EDT 2011


On 07/28/2011 06:21 PM, Eric Noulard wrote:
> 2011/7/28 Julien Dardenne <julien.dardenne at technooliq.com>
>>
>> Hi,
>>
>> I compile my libraries into dynamic and static.
>> I now wish to change the library path. If I am in static (folder : lib ) and dynamic (folder : dll).
>>
>> For now, i have this script :
>>
>> OPTION (BUILD_SHARED_LIBS "Build shared libraries with Games." OFF)
>>
>> IF (BUILD_SHARED_LIBS)
>> SET (LIBRARY_OUTPUT_PATH)
>> SET ($ {LIBRARY_OUTPUT_PATHPROJECT_BINARY_DIR} / dll / $ {CACHE}CMAKE_BUILD_TYPE PATH "Single outputdirectory for building all libraries.")
>> ELSE ()
>> SET (LIBRARY_OUTPUT_PATH)
>> SET ($ {LIBRARY_OUTPUT_PATHPROJECT_BINARY_DIR} / lib / $ {CACHE}CMAKE_BUILD_TYPE PATH "Single outputdirectory for building all libraries.")
>> ENDIF ()
>>
>> but my variable "LIBRARY_OUTPUT_PATH" does not change.
>>
>> Do you have an idea about this problem ?
> 
> Your CMakeLists.txt syntax is weird.
> Is there any copy/paste trouble or did you literally wrote:
> 
> SET (${LIBRARY_OUTPUT_PATHPROJECT_BINARY_DIR} / dl l/ ${CACHE} CMAKE_BUILD_TYPE
>          PATH
>         "Single outputdirectory for building all libraries.")
> 
> If you wrote this I cannot see how this could work.
> I would expect something like
> 
> SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/dll)
> 
> and if it should go in CACHE add CACHE <type> <comment>.

Julien, besides the strange notation, keep in mind that

(1) LIBRARY_OUTPUT_PATH is obsolete, use the CMAKE_{ARCHIVE,
    LIBRARY,RUNTIME}_OUTPUT_DIRECTORY variables instead, and
(2) on DLL platforms aka Windows, DLLs are classified as run-
    time targets, i.e. the RUNTIME variables/properties apply.

Regards,

Michael


More information about the CMake mailing list