Skip to content

Commit d057f65

Browse files
create .so lib with cmake
1 parent 065b66f commit d057f65

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# ignore build folders
66
bin
77
build
8-
cmakebuild
8+
sconsbuild
99

1010
# ignore test files
1111
*.json

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ set(CMAKE_CXX_STANDARD 17)
33
set(CMAKE_CXX_STANDARD_REQUIRED ON)
44

55
project(forefire VERSION 1.0)
6+
67
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../bin)
8+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/../lib)
79

810
link_libraries("-lnetcdf_c++ -lnetcdf")
911

1012
file(GLOB_RECURSE SRC_FILES src/*.cpp)
1113

12-
add_executable(forefire ${SRC_FILES})
14+
add_executable(forefire ${SRC_FILES})
15+
16+
add_library(forefireL SHARED ${SRC_FILES})

Sconstruct

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ if int(warnings):
1515

1616

1717
files = Glob('./sconsbuild/*.cpp')
18-
env.Program('./bin/CommandShell', files, LIBS=['netcdf_c++', 'netcdf'])
1918

20-
env.SharedLibrary('./lib/ForeFire', files, LIBS=['netcdf_c++', 'netcdf'])
19+
env.Program('./sconsbuild/bin/CommandShell', files, LIBS=['netcdf_c++', 'netcdf'])
20+
21+
env.SharedLibrary('./sconsbuild/lib/ForeFire', files, LIBS=['netcdf_c++', 'netcdf'])
2122

0 commit comments

Comments
 (0)