Issue
I have two files in my project called Test4
:
Structure.h
Structure.c
I want to create a static library that can be loaded by other projects who want to use those files. Here is my CMake file currently:
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 using that CMake file, no static library is generated. Nothing happens. Am I doing something wrong?
I am using the CLion IDE.
Solution
I had same issue. What I missed is the location where build files are created.
CLion makes libraries or exectables under cmake-build-*
directory. IfBuild, Execution, Deployment > CMake > Configuration
is Debug
, the lib file (.a
) is created under cmake-build-debug
.
Answered By - noobar Answer Checked By - Robin (WPSolving Admin)