Skip to content

Commit

Permalink
Add option CxxUrl_BUILD_STATIC_LIBS
Browse files Browse the repository at this point in the history
  • Loading branch information
thehitek committed Nov 30, 2024
1 parent b45863c commit 2b449cf
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 2 deletions.
55 changes: 55 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,56 @@
# Compiled Object files
**/.DS_Store
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

**/cmake-build-debug
**/CMakeCache.txt
**/cmake_install.cmake
**/install_manifest.txt
**/CMakeFiles/
**/CTestTestfile.cmake
**/Makefile
**/*.cbp
**/CMakeScripts
**/compile_commands.json

include/divisible/*


## Local

.idea/*.xml

build/**/*

include/*
lib/*
bin/*
test/test_runner
CxxUrl.pro.*
10 changes: 8 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.4)
cmake_minimum_required(VERSION 3.10)
project(CxxUrl
VERSION 0.3.0
)
Expand All @@ -11,6 +11,7 @@ project(CxxUrl
#*********************************************************

option(ENABLE_INSTALL "Flag to indicate if the install target should be available" ON)
option(CxxUrl_BUILD_STATIC_LIBS "Whether build shared or static" ON)

if(${PROJECT_IS_TOP_LEVEL})
# This will be executed if the current project is top level
Expand Down Expand Up @@ -54,7 +55,12 @@ set(SOURCES
${HEADERS}
${CMAKE_CURRENT_SOURCE_DIR}/url.cpp)

add_library(${TARGET_NAME} SHARED ${SOURCES})
if(CxxUrl_BUILD_STATIC_LIBS)
add_library(${TARGET_NAME} STATIC ${SOURCES})
else()
add_library(${TARGET_NAME} SHARED ${SOURCES})
endif()

add_library(${NAMESPACE}::${TARGET_NAME} ALIAS ${TARGET_NAME})

set_target_properties(${TARGET_NAME} PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON)
Expand Down

0 comments on commit 2b449cf

Please sign in to comment.