[CMake] Issue w/ myproj-targets-<buildtype>.cmake not being generated.

Raindog raindog at macrohmasheen.com
Thu Oct 6 22:56:07 EDT 2011


On 10/6/2011 7:04 PM, Raindog wrote:
> Hello,
>
> I have code like the following in my CMakeLists.txt file to make it 
> simpler to import code from a library.
>
> install(TARGETS ${PROJECT_NAME} DESTINATION 
> ${CMAKE_CURRENT_SOURCE_DIR}/../lib/${BUILD_TYPE_GNU_ONLY} EXPORT 
> ${PROJECT_NAME}-targets)
> install(EXPORT ${PROJECT_NAME}-targets DESTINATION 
> ${CMAKE_CURRENT_SOURCE_DIR}/../lib/${BUILD_TYPE_GNU_ONLY})
>
>
> The problem I have, is that for one project, it creates the files:
>
> myproja-targets.cmake
> myproja-targets-<buildtype>.cmake
>
> However, the same lines of code in a different project only produces
>
> myprojb-targets.cmake
>
> And when myprojc tries to use myprojb via:
>
> include(${CMAKE_CURRENT_SOURCE_DIR}/../myprojb/lib/${BUILD_TYPE_GNU_ONLY}/myprojb-targets.cmake) 
>
>
> It fails, however the same line above modified for myproja succeeds
>
> As a note, the lib files for myproja and myprojb are both created and 
> installed as expected.
>
> During writing this, I discovered a minor discrepancy in the install 
> outputs, the one that succeeds, has this:
> -- Install configuration: "<build type>"
>
> However, the one that fails has:
> -- Install configuration: ""
>
> The interesting thing to me is that I did not specify the build type 
> in a different way, both CMakeLists.txt include a file that sets 
> CMAKE_BUILD_TYPE automatically if not specified on the cmd line.
>
> Any suggestions?
>
> Thanks
> -- 

I've made a discovery that if I set the CMAKE_BUILD_TYPE from the 
command line when calling cmake, everything works for both projects, 
however, myproja still does not require any specification from the 
command line, while the 2nd project does. Any suggestions?


More information about the CMake mailing list