Cmake suddenly cannot find my source files anymore

Shortly speaking:

alt text http://www.uni-koblenz.de/~aheld/Cmake%20wears%20very%20dark%20sunglasses.png

To add insult to injury, CMake actually ran excellent several times. I struggled with a compiler error when CMake suddenly did not want to work. For reference, here is the entire CMakeLists.txt file:

set(CMAKE_INCLUDE_CURRENT_DIR ON)

Find_Package ( SDL REQUIRED )
Find_Package ( SDL_image REQUIRED )
Find_Package ( SDL_mixer REQUIRED )

if ( NOT SDL_FOUND )
   message ( FATAL_ERROR "Make sure that SDL is installed" )
endif ( NOT SDL_FOUND )

link_libraries (
   ${SDL_LIBRARY}
   ${SDLIMAGE_LIBRARY}
   ${SDLMIXER_LIBRARY}
   SDLmain
)

set(wiggle_SOURCES 
        level.cpp
        levelgenerator.cpp
        main.cpp
        player.cpp
        scoreboard.cpp
        snake.cpp
        soundplayer.cpp
        titlescreen.cpp
    )

add_executable(Wiggle ../${wiggle_SOURCES})

The error occurred the first time, instead of typing โ€œmakeโ€ I typed โ€œmake -lSDL -lSDL_image -lSDL_mixerโ€ - I refused to find the header files SDL.h and SDL_image.h after I disconnected the project from the code :: Blocks.

+3
source share
1 answer

This line:

add_executable(Wiggle ../${wiggle_SOURCES})

Will expand to:

 add_executable(Wiggle ../level.cpp levelgenerator.cpp main.cpp etc)

, , , . , , level.cpp , ?

+4

Source: https://habr.com/ru/post/1736614/


All Articles