Skip to content

Commit

Permalink
Refactor include paths and update CMakeLists with STATIC libraries
Browse files Browse the repository at this point in the history
Standardize include paths to use angle brackets for library headers and update CMakeLists to specify STATIC libraries for encoder and decoder. Also, add target_include_directories for proper include paths.
  • Loading branch information
SeriousSamV committed Nov 1, 2024
1 parent 59e5ac1 commit 5acd691
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ endif()
include(CTest)
enable_testing()

add_library(tiny_url_encoder_lib src/tiny_url_encoder.c src/tiny_url_encoder.h)
add_library(tiny_url_encoder_lib STATIC src/tiny_url_encoder.c src/tiny_url_encoder.h)
target_include_directories(tiny_url_encoder_lib PUBLIC src)

add_executable(assert_tiny_url_encoder test/assert_tiny_url_encoder.c)
target_link_libraries(assert_tiny_url_encoder tiny_url_encoder_lib)
add_test(test_tiny_url_encoder assert_tiny_url_encoder)

add_library(tiny_url_decoder_lib src/tiny_url_decoder_lib.c src/tiny_url_decoder_lib.h)
add_library(tiny_url_decoder_lib STATIC src/tiny_url_decoder_lib.c src/tiny_url_decoder_lib.h)
target_include_directories(tiny_url_decoder_lib PUBLIC src)

add_executable(assert_tiny_url_decoder test/assert_tiny_url_decoder.c)
target_link_libraries(assert_tiny_url_decoder tiny_url_decoder_lib)
Expand Down
2 changes: 1 addition & 1 deletion src/tiny_url_decoder_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Created by Samuel Vishesh Paul on 01/11/24.
//

#include "tiny_url_decoder_lib.h"
#include <tiny_url_decoder_lib.h>

#include <ctype.h>
#include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion src/tiny_url_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Created by Samuel Vishesh Paul on 01/11/24.
//

#include "tiny_url_encoder.h"
#include <tiny_url_encoder.h>

#include <ctype.h>
#include <stdlib.h>
Expand Down
2 changes: 1 addition & 1 deletion test/assert_tiny_url_decoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <assert.h>
#include <string.h>

#include "../src/tiny_url_decoder_lib.h"
#include <tiny_url_decoder_lib.h>

void test_url_decode() {
const uint8_t src1[] = "hello%21";
Expand Down
2 changes: 1 addition & 1 deletion test/assert_tiny_url_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <assert.h>
#include <string.h>

#include "../src/tiny_url_encoder.h"
#include <tiny_url_encoder.h>

void test_url_encode() {
// Test 1: Encode "hello!" (symbol !)
Expand Down

0 comments on commit 5acd691

Please sign in to comment.