[CMake] faking convenience libraries
Brandon J. Van Every
bvanevery at gmail.com
Thu Jan 25 13:36:11 EST 2007
Bill Hoffman wrote:
> 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}
It seems that MSVC and MSYS don't use CMAKE_FILES_DIRECTORY in the same
way. I can do IF(MSVC), but are there going to be any more
per-generator variations in directory structure? Also I'll have to
document the behavior of CMAKE_FILES_DIRECTORY better on the wiki.
Previously I said that's where CMake generated files live, and for MSVC
this is not the case.
Cheers,
Brandon Van Every
More information about the CMake
mailing list