take a look at the following location:

<http://www.bluequartz.net/cgi-bin/gitweb/gitweb.cgi?p=MXADataModel.git;a=tree >

My project is laid out in the following way:

Project
   Resources
      CMake
   Source
     MXA
       Common

So Basically all my cmake type of support files go in Project/ Resources/CMake and all the source code is in "Source". All the code is organized by folder structures. Inside each folder there is a "*.cmake" file that lists the source codes (source and headers) for that folder. In the top level cmake file I optionally include each of those *.cmake files to build up a source list. Inside the *.cmake file I call a macro which uses the "Source_group" command to help VS replicate the folder structure. This also works for Xcode also BTW. This particular project only builds 1 library and a bunch of unit test executables plus one small utility. If you look elsewhere in the git repository there is another project called "MXATools" which is a collection of Qt based programs and command line programs. They are laid out the same way as the first project.

MXADataModel (the first project) is dependent on Boost and you can see the basic code that is used to find boost (built into CMake 2.6.3 and greater). As far as external libraries I ended up writing my own "Find*.cmake' files since I was writing CMake build scripts for those libraries any ways (Tif, Expat and HDF5).

Take a look at the code and ask questions if you need. You are welcome to any of the CMake code for your own use. I also welcome feedback on the code from a "new users" perspective. ;-)

_________________________________________________________
Mike Jackson                  mike.jack...@bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio



On May 9, 2009, at 3:00 PM, Brandon Olivares 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.

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


_______________________________________________
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

_______________________________________________
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

Reply via email to