Skip to content

Commit 294755f

Browse files
committed
build: refine CMakeLists.txt by removing unnecessary conditions and options
- Eliminated the default installation prefix condition to streamline the configuration. - Simplified the test build logic by ensuring tests are enabled only for top-level projects. - Cleaned up redundant code for better readability and maintainability.
1 parent 714a297 commit 294755f

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

CMakeLists.txt

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ PROJECT(CPPJIEBA)
44
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/deps/limonp/include
55
${PROJECT_SOURCE_DIR}/include)
66

7-
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
8-
set (CMAKE_INSTALL_PREFIX "/usr/local/cppjieba" CACHE PATH "default install path" FORCE )
9-
endif()
10-
117
if(NOT DEFINED CMAKE_CXX_STANDARD)
128
set(CMAKE_CXX_STANDARD 11)
139
endif()
@@ -25,17 +21,11 @@ if(NOT DEFINED CPPJIEBA_TOP_LEVEL_PROJECT)
2521
endif()
2622
endif()
2723

28-
29-
option(CPPJIEBA_BUILD_TESTS "Build cppjieba tests" ${CPPJIEBA_TOP_LEVEL_PROJECT})
30-
31-
if(CPPJIEBA_BUILD_TESTS)
24+
if(CPPJIEBA_TOP_LEVEL_PROJECT)
3225
ENABLE_TESTING()
3326

3427
message(STATUS "MSVC value: ${MSVC}")
3528
ADD_SUBDIRECTORY(test)
3629
ADD_TEST(NAME ./test/test.run COMMAND ./test/test.run)
3730
ADD_TEST(NAME ./load_test COMMAND ./load_test)
38-
endif()
39-
40-
41-
# ... other CMake configurations ...
31+
endif()

0 commit comments

Comments
 (0)