[CMake] MIDL and Visual Studio 10 with |CMake 2.8.3

David Hunter davidhunter22 at gmail.com
Tue Nov 9 05:41:38 EST 2010


I have a project containing a few MIDL files that has been working
fine using the "Visual Studio 9 2008" generator. I have been migrating
the project over to Visual Studio 2010 which includes using the cmake
"Visual Studio 10" generator. However the resultant Visual Studio 2010
files do not seems to recognize the idl files, they appear as simple
text files and consequently no call is made to the MIDL compiler. Is
this expected, in the sense of there being no support, or is there
some change I need to make to the input CMakeList.txt files in this
new version. Note I am using CMake 2.8.3 on a Window 7 box.

An test case, fairly minimal CMakeList.txt file I was trying is as
follows. It builds client and server side library for other bits of
the program to link to ( I would be interested if anyone has helpful
criticisms of my probably woeful CMake style/ability )


add_definitions(-DSECURITY_WIN32)

include_directories(
    ${CMAKE_CURRENT_BINARY_DIR}/rpc_server.dir/${CMAKE_CFG_INTDIR}
    ${CMAKE_CURRENT_SOURCE_DIR})


set( FileListServer
    Server.cpp
    Server.h
    Test.idl
    dlldefines.h)

source_group( "" FILES ${FileListServer} )

add_library(
    rpc_server ${LIBRARY_SHARED_OR_STATIC}
    ${FileListServer})

target_link_libraries(rpc_server rpcrt4.lib ntdsapi.lib secur32.lib
netapi32.lib)

install(TARGETS rpc_server RUNTIME DESTINATION bin LIBRARY DESTINATION lib)


set( FileListClient
    Client.cpp
    Client.h
    dlldefines.h)


source_group( "" FILES ${FileListClient} )

add_library(
    rpc_client ${LIBRARY_SHARED_OR_STATIC}
    ${FileListClient})

target_link_libraries(rpc_client rpcrt4.lib ntdsapi.lib secur32.lib
netapi32.lib)

install(TARGETS rpc_client RUNTIME DESTINATION bin LIBRARY DESTINATION lib)


More information about the CMake mailing list