[CMake] CMake and Visual Studio

Brandon Olivares programmer2188 at gmail.com
Sat May 9 15:00:32 EDT 2009


Hi,

I'm trying to use Cmake for a cross-platform application. I'm trying to
configure it for Visual Studio on Windows, since that's what I use to
develop in.

Is there a better way of adding files, though? I can't really add files from
within Visual Studio, it appears, because it'd go in the build directory.

Also, is there any better way to actually replicate the folder structure of
the source code?

I might just move to using vim because using Visual Studio is quite a pain
at this point, but in case someone else wants to build it or contribute to
the code, developing in Visual Studio, I'd like to make it as easy as
possible.

I'm just starting out with this, but here's my current CMakeLists.txt in the
src directory.

set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)

set(FC_SRCS main.cpp)

include_directories(${PROJECT_SOURCE_DIR}/include)

if(MSVC_IDE)
  file(GLOB_RECURSE FC_HEADERS ${PROJECT_SOURCE_DIR}/include/*.hpp)
  source_group("Header Files" FILES ${FC_HEADERS})
  list(APPEND FC_SRCS ${FC_HEADERS})
endif()

add_executable(fight-controller ${FC_SRCS})

include(CPack)

Thanks,
Brandon

-- 
www.perpetualseeker.com
Blog about college, programming, and other random things.
Follow me on Twitter: http://twitter.com/devbanana




More information about the CMake mailing list