Cmake & gcc writes every file every time

I am studying a C ++ developer writing a game first on a Mac platform using Xcode, but now moving to the platform using CMake. For now, I can compile it on my ickle linux netbook, and I am building a development environment on this machine for encoding. However, I find that gcc recompiles every file whenever I make changes. Obviously, I need additional customization for CMakeLists.txt. My current is very simple. Thus,

cmake_minimum_required (VERSION 2.8)
set (source
Creature.cpp
DisplayManager.cpp
Engine.cpp
EngineState.cpp
Entity.cpp
GameWorld.cpp
GfxSFML.cpp
Item.cpp
Map.cpp
Position.cpp
Projectile.cpp
ScreenTile.cpp
SquadAI.cpp
Terrain.cpp
UIButton.cpp
UICharPanel.cpp
UIView.cpp
Utility.cpp
Weapon.cpp
fov.cpp
main.cpp
)

find_package (OpenAL)
find_package (OpenGL)
find_package (SFML)

set(CMAKE_CXX_FLAGS "-g -Wall -pg")
add_executable (tractionedge ${source})
target_link_libraries(tractionedge ${SFML_LIBRARY} ${OPENGL_LIBRARY} ${OPENAL_LIBRARY})

So far, I have concentrated on C ++ as a language, rather than building systems, sticking with Xcode for everything. My knowledge of Autotools (make?) And Gcc is very limited. How can gcc only recompile a modified source?

+5
source share
5

cmake ? , make, . cmake, .

cmake, .

+6

. , , cpp, . , , cpp ( ), , , , EMail .

, 2.8 cmake, . 2.9, , : http://www.mail-archive.com/cmake@cmake.org/msg24876.html

+3

CMakeLists.txt glob (, src, *.cpp) ( ):

cmake_minimum_required (VERSION 2.8)
project(TRACTION)
file (GLOB TRACTION_SOURCES *.cpp)
find_package (OpenAL)
find_package (OpenGL)
find_package (SFML)

set(CMAKE_CXX_FLAGS "-g -Wall -pg")
add_executable (tractionedge ${TRACTION_SOURCES})
target_link_libraries(tractionedge ${SFML_LIBRARY} ${OPENGL_LIBRARY} ${OPENAL_LIBRARY})
0

I also experienced unnecessary adjustments using CMake and visual studio. The problem is related to an inappropriate x64 configuration parameter: Unprocessed building of Visual Studio 2008

0
source

A simple solution in many of these cases is to completely erase the assembly tree and restore it (and I mean something line by line rm -rf build && mkdir build && cd build && cmake -G "Unix Makefiles" ../src, not just that make clean)

-2
source

All Articles