Skip to content

Commit

Permalink
fix cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
limuy2022 committed Nov 26, 2023
1 parent 55b05dd commit 56155e8
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 42 deletions.
61 changes: 39 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,28 @@ link_directories("${PROJECT_SOURCE_DIR}/bin")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")

#add_subdirectory(language)

#add_compile_definitions("UNITTEST")
#file(GLOB_RECURSE TEST_SOURCES "tests/unittest/*.cpp")
#file(GLOB_RECURSE TEST_MODULE_SOURCES "tests/unittest/*.cppm")
#add_library(testmodulefiles)
#
#target_sources(testmodulefiles
# PUBLIC
# FILE_SET CXX_MODULES FILES
# ${SOURCES}
# ${LANGUAGE_SOURCES}
# ${TEST_MODULE_SOURCES}
#)
#
#add_executable(unittest
# ${CPP_SOURCES}
# ${TEST_SOURCES}
#)
#target_link_libraries(unittest testmodulefiles language)

add_subdirectory("cmake_third_party/googletest")
include_directories("cmake_third_party/googletest/googletest/include")

add_library(language_module)
target_sources(language_module
PUBLIC
FILE_SET CXX_MODULES FILES
language/language.cppm
)

message("${LANGUAGE_SOURCES}")

add_library(Chinese language/chinese.cpp)

add_library(English language/english.cpp)

add_library(language language/english.cpp)

target_link_libraries(Chinese language_module)
target_link_libraries(English language_module)
target_link_libraries(language language_module)

file(GLOB_RECURSE CPPMSOURCES "*.cppm")
file(GLOB_RECURSE CPP_SOURCES "src/*.cpp")

Expand All @@ -52,4 +50,23 @@ target_sources(foo
add_executable(Trc ${CPP_SOURCES})

target_link_libraries(Trc foo)
target_link_libraries(Trc "language")
target_link_libraries(Trc language)


file(GLOB_RECURSE TEST_SOURCES "tests/unittest/*.cpp")
file(GLOB_RECURSE TEST_MODULE_SOURCES "tests/unittest/*.cppm")
add_library(testmodulefiles)

target_sources(testmodulefiles
PUBLIC
FILE_SET CXX_MODULES FILES
${CPPMSOURCES}
${TEST_MODULE_SOURCES}
)

add_executable(unittest
${CPP_SOURCES}
${TEST_SOURCES}
)
target_compile_definitions(unittest PRIVATE "UNITTEST")
target_link_libraries(unittest testmodulefiles language gtest)
20 changes: 0 additions & 20 deletions language/CMakeLists.txt

This file was deleted.

0 comments on commit 56155e8

Please sign in to comment.