[CMake] faking convenience libraries

Bill Hoffman bill.hoffman at kitware.com
Thu Jan 25 08:23:54 EST 2007


Brandon J. Van Every wrote:
> Bill Hoffman wrote:
>>
>> You can not use FIND_* stuff because the files will not be there.   
>> There is a risk that cmake could change where the .o files are put.  
>> To mitigate that risk, I would recommend setting up everything with 
>> variables.   You already have these 
>> ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}.  That will give you the 
>> CMakeFiles directory, then each library is in LibName.dir and the obj 
>> files should be in there.   It would be safest to write a macro that 
>> converts a source name into a .o name, that way if cmake changes, you 
>> can just change the macro.
>
> How will I extract the type of build at configuration time?  Currently 
> I'm using code such as:
> SET(PCRE_FOR_SHARED_OBJ_DIR
> ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/libpcre-for-shared.dir/${CMAKE_BUILD_TYPE}) 
>
>
> but CMAKE_BUILD_TYPE has no value when running CMakeSetup for VS71.
Use CMAKE_CFG_INTDIR.  For VS IDE projects the object files will be in:

${CMAKE_CURRENT_BINARY_DIR}/libpcre-for-shared.dir/${CMAKE_CFG_INTDIR}

-Bill





More information about the CMake mailing list