[CMake] CMake and Visual Studio

John Drescher drescherjm at gmail.com
Sat May 9 15:27:53 EDT 2009


On Sat, May 9, 2009 at 3:00 PM, Brandon Olivares
<programmer2188 at gmail.com> wrote:
> 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.
>
This will not add them to the CMakeLists.txt either so its really no
good use to add files in Visual Studio itself. I just associate
CMakeLists.txt to Notepad++ and then click on that in the Solution
View and then edit the CMakeLists.txt file and have Notepad++ create
the files.

http://notepad-plus.sourceforge.net/uk/site.htm

>
> Also, is there any better way to actually replicate the folder structure of
> the source code?
>
I am confused at that question.
I have my code organized as

Project

>
> 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
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>



-- 
John M. Drescher


More information about the CMake mailing list