My project Test4
contains two files named:
Structure.h
Structure.c
I am using this project to create a static library that can be used by other software projects.
cmake_minimum_required(VERSION 3.6)
project(Test4)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(SOURCE_FILES Structure.c Structure.h)
add_library(Test4 STATIC ${SOURCE_FILES})
When I build the Test4
project using the CMake configuration file above, no static library is generated. It seems as if nothing happens. Does anyone know what I am doing wrong?
My IDE is JetBrains CLion.
I had the same issue. What I was missing was the location where build files are generated.
By default, when using CLion, the compiler generates libraries and executables in the cmake-build-*
directory. If the setting located at...
Build > Execution > Deployment > CMake > Configuration
is set to "Debug"
, then the generated archive file (.a
) file appended with an a, is created under cmake-build-debug
.